You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to rebuild my tabController depending on some feature flags being on or off.
final featureFlags = useState(database.getFeatureFlags());
database.featureFlagsBox.watch(key: "feature_flags").listen((event) {
featureFlags.value = event.value;
});
final allPages = useMemoized(() {
return _buildPages(featureFlags.value);
}, [featureFlags.value]);
final _ticker = useSingleTickerProvider();
final _tabController = useTabController(initialLength: allPages.length, vsync: _ticker, keys: [featureFlags.value]);
Doing that results in and error:
The following assertion was thrown building CollectionsPage(dirty, dependencies: [_EffectiveTickerMode, _LocalizationsScope-[GlobalKey#13ef1], _InheritedTheme], useState<FeatureFlags>: Instance of 'FeatureFlags', useMemoized<List<PageViewDescription>>: [Instance of 'PageViewDescription'], useSingleTickerProvider):
A TabController was used after being disposed.
Once you have called dispose() on a TabController, it can no longer be used.
The relevant error-causing widget was:
CollectionsPage .../lib/components/screens/home/HomeScreen.dart:44:67
When the exception was thrown, this was the stack:
#0 ChangeNotifier._debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:117:9)
#1 ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:123:6)
#2 ChangeNotifier.dispose (package:flutter/src/foundation/change_notifier.dart:212:12)
#3 TabController.dispose (package:flutter/src/material/tab_controller.dart:299:11)
#4 _TabControllerHookState.dispose (package:flutter_hooks/src/tab_controller.dart:57:33)
I am trying to rebuild my
tabController
depending on some feature flags being on or off.Doing that results in and error:
Probably related to #81
The text was updated successfully, but these errors were encountered: