AppBar constructor Null safety

AppBar(
  1. {Key? key,
  2. Widget? leading,
  3. bool automaticallyImplyLeading: true,
  4. Widget? title,
  5. List<Widget>? actions,
  6. Widget? flexibleSpace,
  7. PreferredSizeWidget? bottom,
  8. double? elevation,
  9. Color? shadowColor,
  10. ShapeBorder? shape,
  11. Color? backgroundColor,
  12. Color? foregroundColor,
  13. Brightness? brightness,
  14. IconThemeData? iconTheme,
  15. IconThemeData? actionsIconTheme,
  16. TextTheme? textTheme,
  17. bool primary: true,
  18. bool? centerTitle,
  19. bool excludeHeaderSemantics: false,
  20. double? titleSpacing,
  21. double toolbarOpacity: 1.0,
  22. double bottomOpacity: 1.0,
  23. double? toolbarHeight,
  24. double? leadingWidth,
  25. bool? backwardsCompatibility,
  26. TextStyle? toolbarTextStyle,
  27. TextStyle? titleTextStyle,
  28. SystemUiOverlayStyle? systemOverlayStyle}
)

Creates a material design app bar.

The arguments primary, toolbarOpacity, bottomOpacity, backwardsCompatibility, and automaticallyImplyLeading must not be null. Additionally, if elevation is specified, it must be non-negative.

Typically used in the Scaffold.appBar property.

Implementation

AppBar({
  Key? key,
  this.leading,
  this.automaticallyImplyLeading = true,
  this.title,
  this.actions,
  this.flexibleSpace,
  this.bottom,
  this.elevation,
  this.shadowColor,
  this.shape,
  this.backgroundColor,
  this.foregroundColor,
  this.brightness,
  this.iconTheme,
  this.actionsIconTheme,
  this.textTheme,
  this.primary = true,
  this.centerTitle,
  this.excludeHeaderSemantics = false,
  this.titleSpacing,
  this.toolbarOpacity = 1.0,
  this.bottomOpacity = 1.0,
  this.toolbarHeight,
  this.leadingWidth,
  this.backwardsCompatibility,
  this.toolbarTextStyle,
  this.titleTextStyle,
  this.systemOverlayStyle,
}) : assert(automaticallyImplyLeading != null),
     assert(elevation == null || elevation >= 0.0),
     assert(primary != null),
     assert(toolbarOpacity != null),
     assert(bottomOpacity != null),
     preferredSize = Size.fromHeight(toolbarHeight ?? kToolbarHeight + (bottom?.preferredSize.height ?? 0.0)),
     super(key: key);