widget property Null safety

Widget widget

The configuration for this element.

Avoid overriding this field on Element subtypes to provide a more specific widget type (i.e. StatelessElement and StatelessWidget). Instead, cast at any callsites where the more specific type is required. This avoids significant cast overhead on the getter which is accessed throughout the framework internals during the build phase - and for which the more specific type information is not used.


Widget get widget => _widget!;