extensions property Null safety

Map<Object, ThemeExtension> extensions
final

Arbitrary additions to this theme.

To define extensions, pass an Iterable containing one or more ThemeExtension subclasses to ThemeData.new or copyWith.

To obtain an extension, use extension.

This sample shows how to create and use a subclass of ThemeExtension that defines two colors.
To create a local project with this code sample, run:
flutter create --sample=material.ThemeData.extensions.1 mysample

See also:

  • extension, a convenience function for obtaining a specific extension.

Implementation

final Map<Object, ThemeExtension<dynamic>> extensions;