【发布时间】:2021-06-23 20:23:26
【问题描述】:
Error: Tried to call Provider.of<dynamic>.
This is likely a mistake and is therefore
unsupported.
If you want to expose a variable that can be anything, consider changing
`dynamic` to `Object` instead.
'package:provider/src/provider.dart':
Failed assertion: line 307 pos 7: 'T != dynamic'
将它从动态转换为对象是什么意思?
代码:
body: SingleChildScrollView(
child: Container(
width: MediaQuery.of(context).size.width,
child: Column(
children: <Widget>[
FutureBuilder(
future: Provider.of(context).auth.getCurrentUser(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return displayUserInformation(context, snapshot);
} else {
return CircularProgressIndicator();
}
【问题讨论】:
标签: flutter class dart provider