我已经升级了我的颤振项目中的软件包,它现在导致了以下问题:
The return type 'Widget Function(BuildContext, Widget)' isn't a 'Widget', as required by the closure's context. Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarColor: Colors.black, statusBarBrightness: Brightness.dark));
return WillPopScope(
onWillPop: () => _willPopCallback(context),
child: BaseView<HomeViewModel>(
onModelReady: (model) => model.setupHome(),
builder: (context, model, child) => BotToastInit (
child: MaterialApp(
navigatorObservers: [BotToastNavigatorObserver()],
home: Scaffold(
body: HomeBodyView(context),
),
),
),
),
);
}罪魁祸首是BotToastInit,它来自于这个图书馆。如果我把这个移除,它就能用,但我需要这个。有人知道怎么解决这个问题吗?
发布于 2021-05-17 17:49:40
BoatTostInit返回一个函数,它是实际的构建器函数!
所以在你的代码位置上
final botToastBuilder = BotToastInit(); -然后将BotToastInit替换为botToastBuilder (并添加上下文参数)。
botToastBuilder(context, MaterialApp...)https://stackoverflow.com/questions/67574624
复制相似问题