当我从最终视图返回到我的“初始视图”State
时,所有 3 个视图中的每一个都BlocProviders
被保存。
我的代码链接在这里: GIST
我不明白我错过了什么,在第一次运行时一切正常。
但是,当我回到InitialView
我所在的位置时GameView
,再次设置所有内容并再次移动到 GameModeSelectionView,它会被多次调用(状态以某种方式保存而不是转储??)(1):
flutter: State of GameSelectionState GameSelectionInitial
flutter: State of GameSelectionState GameSelectionStart
flutter: State of QuestionState StopQuestion
flutter: OK?
flutter: State of GameSelectionState GameSelectionStart
flutter: State of QuestionState StopQuestion
flutter: OK?
flutter: State of GameSelectionState GameSelectionStart
flutter: State of QuestionState StopQuestion
flutter: OK?
flutter: State of GameSelectionState GameSelectionInitial
这个过程随着每次迭代而增长(1)
我正在使用 flutter_bloc 依赖项: https ://pub.dev/packages/flutter_bloc