An application that uses material design.

A convenience widget that wraps a number of widgets that are commonly required for material design applications. It builds upon a WidgetsApp by adding material-design specific functionality, such as AnimatedTheme and GridPaper.

The MaterialApp configures the top-level Navigator to search for routes in the following order:

  1. For the / route, the home property, if non-null, is used.

  2. Otherwise, the routes table is used, if it has an entry for the route.

  3. Otherwise, onGenerateRoute is called, if provided. It should return a non-null value for any valid route not handled by home and routes.

  4. Finally if all else fails onUnknownRoute is called.

At least one of these options must handle the / route, since it is used when an invalid initialRoute is specified on startup (e.g. by another application launching this one with an intent on Android; see Window.defaultRouteName).

This widget also configures the top-level Navigator's observer to perform Hero animations.

See also:

  • Scaffold, which provides standard app elements like an AppBar and a Drawer.
  • Navigator, which is used to manage the app's stack of pages.
  • MaterialPageRoute, which defines an app page that transitions in a material-specific way.
  • WidgetsApp, which defines the basic app elements but does not depend on the material library.


MaterialApp({Key key, String title, Color color, ThemeData theme, Widget home, Map<String, WidgetBuilder> routes: const {}, String initialRoute, RouteFactory onGenerateRoute, RouteFactory onUnknownRoute, LocaleChangedCallback onLocaleChanged, List<NavigatorObserver> navigatorObservers: const [], bool debugShowMaterialGrid: false, bool showPerformanceOverlay: false, bool checkerboardRasterCacheImages: false, bool checkerboardOffscreenLayers: false, bool showSemanticsDebugger: false, bool debugShowCheckedModeBanner: true })
Creates a MaterialApp. [...]


checkerboardOffscreenLayers bool
Turns on checkerboarding of layers rendered to offscreen bitmaps.
checkerboardRasterCacheImages bool
Turns on checkerboarding of raster cache images.
color Color
The primary color to use for the application in the operating system interface. [...]
debugShowCheckedModeBanner bool
Turns on a little "SLOW MODE" banner in checked mode to indicate that the app is in checked mode. This is on by default (in checked mode), to turn it off, set the constructor argument to false. In release mode this has no effect. [...]
debugShowMaterialGrid bool
Turns on a GridPaper overlay that paints a baseline grid Material apps. [...]
home Widget
The widget for the default route of the app (Navigator.defaultRouteName, which is /). [...]
initialRoute String
The name of the first route to show. [...]
The list of observers for the Navigator created for this app.
onGenerateRoute RouteFactory
The route generator callback used when the app is navigated to a named route. [...]
onLocaleChanged LocaleChangedCallback
Callback that is called when the operating system changes the current locale.
onUnknownRoute RouteFactory
Called when onGenerateRoute fails to generate a route, except for the initialRoute. [...]
routes Map<String, WidgetBuilder>
The application's top-level routing table. [...]
showPerformanceOverlay bool
Turns on a performance overlay. [...]
showSemanticsDebugger bool
Turns on an overlay that shows the accessibility information reported by the framework.
theme ThemeData
The colors to use for the application's widgets.
title String
A one-line description of this app for use in the window manager.
hashCode int
The hash code for this object. [...]
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


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


operator ==(other) bool
The equality operator. [...]