ComposableMaterialApp<AppState, AppAction> class

A MaterialApp.router wrapper that integrates with a Store.

Observes MaterialAppState from your app state and automatically rebuilds when locale or brightness changes. Optionally listens to platform events (locale changes, brightness, app lifecycle, etc.) via the observer mixin.

Example

import 'package:composable_architecture_widgets/material.dart';

ComposableMaterialApp<AppState, AppAction>(
  title: 'My App',
  store: appStore,
  toMaterialAppState: (state) => state.materialAppState,
  toThemeData: (appState) => ThemeData(brightness: appState.brightness),
  routerConfig: routerConfig,
);
Inheritance

Constructors

ComposableMaterialApp({Key? key, required String title, required Store<AppState, AppAction> store, required MaterialAppState toMaterialAppState(AppState), RouterConfig<Object>? routerConfig, Widget builder(BuildContext, Widget?)?, WidgetBindingReducer<AppAction>? observer, Iterable<LocalizationsDelegate>? localizationsDelegates, ThemeData toThemeData(MaterialAppState appState)?, Iterable<Locale> supportedLocales = const [Locale('en')], LocaleListResolutionCallback? localeListResolutionCallback, LocaleResolutionCallback? localeResolutionCallback, dynamic onAppStart()?})
Creates a ComposableMaterialApp.
const

Properties

builder Widget Function(BuildContext, Widget?)?
Optional builder wrapping the MaterialApp's navigator.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
localeListResolutionCallback LocaleListResolutionCallback?
Locale list resolution callback.
final
localeResolutionCallback LocaleResolutionCallback?
Locale resolution callback.
final
localizationsDelegates Iterable<LocalizationsDelegate>?
Localization delegates passed to MaterialApp.
final
observer WidgetBindingReducer<AppAction>?
Optional mixin that maps platform events to store actions.
final
onAppStart → dynamic Function()?
Called after the first frame is rendered.
final
routerConfig RouterConfig<Object>?
Router configuration for MaterialApp.router.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
store Store<AppState, AppAction>
The application store.
final
supportedLocales Iterable<Locale>
Supported locales passed to MaterialApp.
final
title String
The title passed to MaterialApp.
final
toMaterialAppState MaterialAppState Function(AppState)
Projects MaterialAppState from the application state.
final
toThemeData ThemeData Function(MaterialAppState appState)?
Maps MaterialAppState to a ThemeData for theming.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ComposableMaterialApp<AppState, AppAction>>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited