标签: dart-pub

如何在仍然引用pub.dartlang.org的包时运行私有pub服务器?

假设我正在pub-dartlang 为私人酒吧饲料运行我自己的实例; 我如何指出pubspec.yaml哪些包来自私人订阅源vs pub.dartlang.org?

dart dart-pub

9
推荐指数
1
解决办法
1246
查看次数

在Dart with Pub中,何时应该对依赖项使用"any"版本约束?

在制作包时,我经常对是否应该使用any约束感到困惑.

我知道这个:

但是有一个灰色区域:

  • 要扩展的应用程序,例如codelabs,教程,模板,示例等.

  • 同样具有可重用库的应用程序 ; 也就是说,包含具有lib通用功能目录的包,这些目录在放入单独的包中是没有意义的,但也是web完整应用程序的目录.


问题:我应该何时使用any版本约束,何时应该完全指定Pub包的版本约束?

versioning dart semantic-versioning dart-pub

8
推荐指数
1
解决办法
86
查看次数

如何在 Flutter SDK 中使用 SVG 或 Vector Drawable

我想在我的 Flutter 应用程序中使用 SVG/矢量图形。有没有可以使用的库或 Dart 包?

dart dart-pub flutter

8
推荐指数
1
解决办法
9992
查看次数

如何找到 Pub 包的大小?

我从 Java 世界来到 Dart 世界,在 Java 中我可以轻松看到 .jar 文件的大小。有时我想要一个包中的一项功能,但如果包太大,就没有理由将所有额外的代码包含到我的应用程序中。

如何查看 pub 套餐的大小?

dart dart-pub

8
推荐指数
2
解决办法
2014
查看次数

Dart 包:依赖冲突

在 Dart/Flutter 项目中,我有

dependencies:
  graphql: '^2.1.1-beta.5'
  flutter_bloc: ^3.0.0
Run Code Online (Sandbox Code Playgroud)

作为依赖。但是,graphql取决于rxdart: ^0.22.0flutter_bloc取决于rxdart: ^0.23.0,这给了我错误:

Because flutter_bloc >=3.0.0 depends on bloc ^3.0.0 which depends on rxdart ^0.23.0, flutter_bloc >=3.0.0 requires rxdart ^0.23.0.
And because graphql 2.1.1-beta.5 depends on rxdart ^0.22.0 and no versions of graphql match >2.1.1-beta.5 <3.0.0, flutter_bloc >=3.0.0 is incompatible with graphql ^2.1.1-beta.5.
So, because com.myapp depends on both graphql ^2.1.1-beta.5 and flutter_bloc ^3.0.0, version solving failed.
Run Code Online (Sandbox Code Playgroud)

我的临时解决方法是降级flutter_bloc^2.1.1,它使用rxdart ^0.23.0 …

dart dart-pub flutter

8
推荐指数
2
解决办法
6105
查看次数

Dart 包版本如何工作以及我应该如何版本我的 Flutter 插件?

我想知道我的 Flutter 应用程序中如何解决 Dart 包版本。

说,我有一个依赖项foo并声明一个这样的依赖项:

dependencies:
  foo: ^1.2.3
Run Code Online (Sandbox Code Playgroud)

Dart Pub 如何知道要解析哪个版本/新版本可用时会发生什么?


此外,如果我想将我的 Flutter 插件发布到 pub.dev,我如何决定何时增加版本的哪个部分?

dart dart-pub flutter

8
推荐指数
1
解决办法
495
查看次数

使用 flutter 在 Listview 上未显示来自服务器 API 的数据

我正在从服务器 API 获取数据,数据已成功从服务器获取,但问题是当数据提供给 Listview 时无法显示。如何在 flutter/dart 中显示 Listview 上的数据?

以下是从服务器 API 获取数据的代码

  List<String> jobTitles = [];
  List officeNames = [ ];
  List officeLocations = [ ];
  List jobTypes = [ ];

  Future getJobsData() async {
    var response = await http
        .get(Uri.https('hospitality92.com', 'api/jobsbycategory/All'));
    Map<String, dynamic> map = json.decode(response.body);
    List<dynamic> jobData = map["jobs"];

    if (jobTitles.length != 0) {
      officeNames.clear();
      jobTitles.clear();
      officeLocations.clear();
      jobTypes.clear();
    }
    for (var i = 0; i < jobData.length; i++) {
      jobTitles.add(jobData[i]["title"]);
      officeNames.add(jobData[i]["company_name"]);
      officeLocations.add(jobData[i]["company_name"]);
      jobTypes.add(jobData[i]["type"]);
    }

    /* print(jobTitles);
    print(officeNames);
    print(officeLocations); …
Run Code Online (Sandbox Code Playgroud)

dart dart-pub flutter flutter-listview

8
推荐指数
1
解决办法
3011
查看次数

flutter Android资源链接失败@mipmap/ic_launcher未找到

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     E:\Programs\Flutter\<My_APP>\build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:16: AAPT: error: resource mipmap/ic_launcher (aka com.example.<My_APP>:mipmap/ic_launcher) not found.

Run Code Online (Sandbox Code Playgroud)

我尝试从 android 清单文件中删除图标,它可以工作,但是我想要 flutter ic_launcher。任何想法,原因是什么?

android dart dart-pub flutter flutter-dependencies

8
推荐指数
3
解决办法
2万
查看次数

Flutter flutter_launcher_icons 错误:pub 已完成,退出代码为 255

我想为 flutter 创建启动器图标。我的配置(pubspec.yaml)如下所示。

\n
...\n  # The following adds the Cupertino Icons font to your application.\n  # Use with the CupertinoIcons class for iOS style icons.\n  cupertino_icons: ^1.0.2\n  flutter_spinkit: ^5.1.0\n  url_launcher: ^6.0.17\n  http: ^0.13.4\n  intl: ^0.17.0\n  flutter_launcher_icons: ^0.9.2\n\nflutter_icons:\n  android: true\n  ios: true\n  image_path: "assets/logo_blue.png"\n...\n
Run Code Online (Sandbox Code Playgroud)\n

我通过控制台安装了 flutter_launcher_icon ( flutter pub add flutter_launcher_icons)。之后,我将配置(见上文)添加到 pubspec.yaml 文件中,并在控制台中输入以下两个命令:

\n
flutter pub get\nflutter pub run flutter_launcher_icons:main\n
Run Code Online (Sandbox Code Playgroud)\n

如文档中所述(https://pub.dev/packages/flutter_launcher_icons)。但在第二个命令之后,我收到以下错误消息,并且 pub 已完成,退出代码为 255。

\n
  \xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\n     FLUTTER LAUNCHER ICONS (v0.9.1)\n  \xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\n\n\n\xe2\x9c\x93 Successfully generated launcher icons\nUnhandled …
Run Code Online (Sandbox Code Playgroud)

dart dart-pub flutter flutter-dependencies pubspec

8
推荐指数
3
解决办法
1万
查看次数

Were can I find "flutter pub list" or "flutter pub search" command line tools?

Where can I find a command line tool for searching and listing installed packaged versions and available upgrade versions?

我想不出任何其他包管理工具不包含列出已安装版本或在不实际升级的情况下查找可用升级的命令。

例如,如果我的 pubspec.yaml 限制版本,则没有简单的方法来检查如果解除限制,哪些固定的软件包可以升级。同样,可以在命令行查看特定软件包的哪些版本可用。

我更喜欢使用命令行工具,因为它的工作流程比需要检查网站上您可能正在使用或通过依赖项继承的每个包要快得多。

dart dart-pub flutter flutter-dependencies

7
推荐指数
2
解决办法
4205
查看次数