排除某些文件/库以用于在颤动腹板中构建 [英] Exclude certain file/lib for building in flutter web
本文介绍了排除某些文件/库以用于在颤动腹板中构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因为颤动网还不支持dart:io
库,而且有很多依赖于dart:io
的包。
在构建我的应用程序期间,我收到此错误
transitive libraries have sdk dependencies that not supported on this platform:
app_core|lib/src/blocs/service/user_chat_bloc.dart
mqtt_client|lib/mqtt_client.dart
假设我想在没有mqtt_client.dart
或user_chat_bloc.dart
的情况下构建。
没有这个库的构建对Web来说不会有什么坏处,但我想保持Ffltter的库是本地的。此外,也没有关于如何跳过生成这些文件的明确文档。
这里的文档https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings也不清楚如何跳过某些文件
我在build.yaml
中尝试过,但没有成功
targets:
$default:
builders:
build_web_compilers|app_core:
generate_for:
exclude:
- lib/src/blocs/service/user_chat_bloc.dart
- lib/mqtt_client.dart
推荐答案
您可以在build.yaml
中这样做:
targets:
$default:
sources:
exclude:
- lib/test_driver/runner.dart
- lib/tools/**.dart
更多详细说明,请查看at the same article you've linked
这篇关于排除某些文件/库以用于在颤动腹板中构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文