ChangeNotifierExt<T extends ChangeNotifier> extension
Extension for managing types that extends ChangeNotifier lifecycle.
Example:
class MyWidgetState extends State<MyWidget>
with TickerProviderStateMixin, RaiiStateMixin {
late final tabController = TabController(length: 3, vsync: this)
.withLifecycle(this, debugLabel: 'Tabs');
late final scrollController =
ScrollController().withLifecycle(this, debugLabel: 'Scroll');
late final textController =
TextEditingController().withLifecycle(this, debugLabel: 'TextInput');
late final focusNode =
FocusNode().withLifecycle(this, debugLabel: 'FocusNode');
}
- on
-
- T
Methods
-
withLifecycle(
RaiiLifecycleAware lifecycleAware, {String? debugLabel}) → T -
Available on T, provided by the ChangeNotifierExt extension
Attaches this change notifier to a RaiiLifecycleAware object for automatic disposal.