如何在Flutter项目中添加自定义库?

时间:2020-04-05 12:28:51

标签: flutter

我想创建一个自定义库,并在Flutter项目中使用它。

我在项目中创建了一个自定义库:

Demo

但是我无法发布它。 (错误)

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout>

这是我的Because write_library_external depends on lib_math from path which doesn't exist (could not find package lib_math at "..\lib_math"), version solving failed. pub get failed (66; Because write_library_external depends on lib_math from path which doesn't exist (could not find package lib_math at "..\lib_math"), version solving failed.)

pubspec.yaml

请帮助我!谢谢!

1 个答案:

答案 0 :(得分:0)

您似乎添加了错误的库path

在您的项目中,您应该尝试在pubspec.yaml处更改文件:

dependencies:
  lib_math:
    path: ../write_library_external/library/lib_math