未处理的异常:在dispose()之后调用setState()

时间:2020-10-15 08:08:59

标签: dispose setstate

我的问题可能是状态管理。 如何设置创建参数?请帮忙!错误可能是什么问题: 未处理的异常:在dispose()之后调用setState()

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider.value(
          value: Auth(),
          
        ),

        // TO DO: provider that provides an instance of the class Project is not set!!!
        ChangeNotifierProxyProvider<Auth, Projects>(
          //  create : (ctx) => Projects(),
            update: (ctx, auth, previousProjects) => Projects(
            auth.token,
            // auth.userEmail,
            previousProjects == null ? [] : previousProjects.items,
          ),

        ),
      ],
      child: Consumer<Auth>(
        builder: (ctx, auth, _) => MaterialApp(
          title: 'IBT',
          theme: ThemeData(
            primarySwatch: Colors.blue,
            accentColor: Colors.white,
            visualDensity: VisualDensity.adaptivePlatformDensity,
          ),
          home: auth.isAuth 
          ? ProjectsOverviewScreen() 
            : AuthScreen(),
                    routes: {
            ProjectsOverviewScreen.id: (ctx) => ProjectsOverviewScreen(),
            NewProject.routeName: (ctx) => NewProject(),
            ProjectDetailScreen.routeName: (ctx) => ProjectDetailScreen(),
          },
        ),
      ),
    );
  }
}

0 个答案:

没有答案