gpt4 book ai didi

flutter - 我迁移到空安全,我不能在没有抛出错误的情况下运行 "flutter pub run build_runner build"

转载 作者:行者123 更新时间:2023-12-03 14:43:57 25 4
gpt4 key购买 nike

我已添加 // @dart=2.9到我的所有文件,但 build_runner不会在不抛出此错误的情况下做它的事情:

Warning: Operand of null-aware operation '?.' has type 'SendPort' which excludes null. - 'SendPort' is from 'dart:isolate'.  sendPort?.send(result);  ^Error: Cannot run with sound null safety, because the following dependencies don't support null safety: 
- package:build_runner_core
- package:json_serializable
- package:moor_generator
- package:objectbox_generator
- package:retrofit_generator
- package:source_gen
- package:build_config
- package:build_runner
- package:build
- package:json_annotation
- package:glob
- package:pool
- package:crypto
- package:logging
- package:watcher
- package:build_resolvers
- package:timing
- package:graphs
- package:package_config
- package:yaml
- package:analyzer
- package:sqlparser
- package:objectbox
- package:dart_style
- package:built_collection
- package:code_builder
- package:dio
- package:tuple
- package:retrofit
- package:pedantic
- package:checked_yaml
- package:pubspec_parse
- package:build_daemon
- package:args
- package:io
- package:convert
- package:pub_semver
- package:ffi
- package:quiver
- package:moor
- package:recase
- package:_fe_analyzer_shared
- package:built_value
- package:http_parser
- package:http_multi_server
- package:shelf
- package:stream_transform
- package:mime
- package:shelf_web_socket
- package:web_socket_channel
- package:cli_util
- package:fixnum
- package:synchronizedFor solutions, see https://dart.dev/go/unsound-null-safety.dart_tool/build/entrypoint/build.dart:44:44: Error: The parameter 'sendPort' can't have a value of 'null' because of its type 'SendPort', but the implicit default value is 'null'. - 'SendPort' is from 'dart:isolate'.Try adding either an explicit non-'null' default value or the 'required' modifier.void main(List<String> args, [_i8.SendPort sendPort]) async {

最佳答案

请确保您的所有软件包都更新为各自的空安全版本。对于构建转轮使用 ^1.12.2然后在您的终端中运行以下命令,同时坐在当前工作目录中。

flutter clean
flutter pub cache repair
flutter pub run build_runner clean
flutter pub get
然后运行 ​​build runner 命令。
这对我有用,我已经使用构建运行器成功生成了文件。

关于flutter - 我迁移到空安全,我不能在没有抛出错误的情况下运行 "flutter pub run build_runner build",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66089455/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com