假设我正在pub-dartlang 为私人酒吧饲料运行我自己的实例; 我如何指出pubspec.yaml哪些包来自私人订阅源vs pub.dartlang.org?
在制作包时,我经常对是否应该使用any约束感到困惑.
我知道这个:
库包,我应该指定明确的版本约束,以便我的库的用户知道我的传递依赖的版本,
应用程序包,我应该使用any并检查我的pubspec.lock锁文件,以便其他人可以运行我的应用程序,
但是有一个灰色区域:
要扩展的应用程序,例如codelabs,教程,模板,示例等.
同样具有可重用库的应用程序 ; 也就是说,包含具有lib通用功能目录的包,这些目录在放入单独的包中是没有意义的,但也是web完整应用程序的目录.
问题:我应该何时使用any版本约束,何时应该完全指定Pub包的版本约束?
我想在我的 Flutter 应用程序中使用 SVG/矢量图形。有没有可以使用的库或 Dart 包?
我从 Java 世界来到 Dart 世界,在 Java 中我可以轻松看到 .jar 文件的大小。有时我想要一个包中的一项功能,但如果包太大,就没有理由将所有额外的代码包含到我的应用程序中。
如何查看 pub 套餐的大小?
在 Dart/Flutter 项目中,我有
dependencies:
graphql: '^2.1.1-beta.5'
flutter_bloc: ^3.0.0
Run Code Online (Sandbox Code Playgroud)
作为依赖。但是,graphql取决于rxdart: ^0.22.0和flutter_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 …
我想知道我的 Flutter 应用程序中如何解决 Dart 包版本。
说,我有一个依赖项foo并声明一个这样的依赖项:
dependencies:
foo: ^1.2.3
Run Code Online (Sandbox Code Playgroud)
Dart Pub 如何知道要解析哪个版本/新版本可用时会发生什么?
此外,如果我想将我的 Flutter 插件发布到 pub.dev,我如何决定何时增加版本的哪个部分?
我正在从服务器 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) 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。任何想法,原因是什么?
我想为 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...\nRun Code Online (Sandbox Code Playgroud)\n我通过控制台安装了 flutter_launcher_icon ( flutter pub add flutter_launcher_icons)。之后,我将配置(见上文)添加到 pubspec.yaml 文件中,并在控制台中输入以下两个命令:
flutter pub get\nflutter pub run flutter_launcher_icons:main\nRun 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) Where can I find a command line tool for searching and listing installed packaged versions and available upgrade versions?
我想不出任何其他包管理工具不包含列出已安装版本或在不实际升级的情况下查找可用升级的命令。
例如,如果我的 pubspec.yaml 限制版本,则没有简单的方法来检查如果解除限制,哪些固定的软件包可以升级。同样,可以在命令行查看特定软件包的哪些版本可用。
我更喜欢使用命令行工具,因为它的工作流程比需要检查网站上您可能正在使用或通过依赖项继承的每个包要快得多。