我注意到我的项目中有一个新的 lint 问题。
长话短说:
我需要在我的自定义类中使用 BuildContext
与 aysnc 方法一起使用时,flutter lint 工具不满意。
例子:
MyCustomClass{
final buildContext context;
const MyCustomClass({required this.context});
myAsyncMethod() async {
await someFuture();
# if (!mounted) return; << has no effect even if i pass state to constructor
Navigator.of(context).pop(); # << example
}
}