提问人:Ерулан Кайырбеков 提问时间:4/25/2023 更新时间:4/25/2023 访问量:28
类型“Null”不是类型转换中类型“String”的子类型。参数:create(ChangeNotifierProxyProvider)
type 'Null' is not a subtype of type 'String' in type cast. Parameter: create(ChangeNotifierProxyProvider)
问:
我不需要创建参数,我添加这个是因为它是必需的。
ChangeNotifierProxyProvider<Auth, TempImages>(
create: (ctx) => TempImages("", "", []),
update: (ctx, auth, previousProducts) => TempImages(
auth.token as String,
auth.userId as String,
previousProducts == null ? [] : previousProducts.items,
),
),
我添加了 String 和 .toString() 方法,但它不起作用。
答:
0赞
Ozan Taskiran
4/25/2023
#1
uth.token as String,
auth.userId as String,
看起来其中一个是空的。请确保将不可为 null 的值传递给 TempImages 构造函数。
评论