1

几个月来我一直在使用代码生成包,今天我在我的一个项目上运行了命令“flutter pub run build_runner build”,一切都建立了,然后当我再次运行它时,我得到了这个错误。

/C:/Users/MyPc/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-1.5.0/liib/src/error/best_practices_verifier.dart:1978:14: Error: A non-null value must ber returned since the return type 'String' doesn't allow null.
  String get displayString {

我应该怎么办?这是突然和意想不到的。

这是我的 pubspec.yaml

name: tutorial
description: A new Flutter project.

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  another_flushbar: ^1.10.23
  auto_route: ^2.2.0
  cupertino_icons: ^1.0.2
  dartz: 0.10.0-nullsafety.2
  firebase_auth: ^1.3.0
  firebase_core: ^1.2.1
  flutter_bloc: ^7.0.1
  freezed_annotation: ^0.14.2
  get_it: ^7.1.3
  google_sign_in: ^5.0.4
  injectable: ^1.4.1
  uuid: ^3.0.4

dev_dependencies:
  flutter_test:
    sdk: flutter
  auto_route_generator: ^2.1.0
  build_runner: null
  flutter_lints: ^1.0.0
  freezed: ^0.14.2
  injectable_generator: ^1.4.1
  lint: ^1.5.3

flutter:
  uses-material-design: true

 
4

1 回答 1

0

您必须更新软件包,或者您只需通过更改 pubspec.yaml 来关闭空安全性

environment:
  sdk: ">=2.11.0 <3.0.0"
于 2021-07-09T16:54:13.193 回答