哇,我有很多这些:
Error: Method 'copyWith' cannot be called on 'TextStyle?' because it is potentially null.
- 'TextStyle' is from 'package:flutter/src/painting/text_style.dart' ('../flutter/packages/flutter/lib/src/painting/text_style.dart'). Try calling using ?. instead.
我不明白指令,我试过天真地附加 ?标记在各个地方,尝试将 'copyWith' 更改为 'apply'。
这是错误代码:
style: Theme.of(context)
.textTheme
.bodyText2
.copyWith(fontWeight: FontWeight.bold)
呃,我不明白。这个空的东西的主要项目更改,而且我觉得我在猜测相当多的时间。我的 dart 文件现在到处都是 !,这看起来非常冗长。
无论如何,如果没有这个,我的项目将无法编译,我有很多,所以感谢帮助。
最佳答案
flutter pub upgrade fwfh_text_style
帮我解决了。
关于 flutter 错误 : Method 'copyWith' cannot be called on 'TextStyle?' because it is potentially null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71095899/