defaultProps property

  1. @override
Map defaultProps
override

Invoked once and cached when registerComponent is called. Values in the mapping will be set on props if that prop is not specified by the parent component.

This method is invoked before any instances are created and thus cannot rely on props. In addition, be aware that any complex objects returned by defaultProps will be shared across instances, not copied.

Example:

// ES6 component
Component.defaultProps = {
  count: 0
};

// Dart component
@override
get defaultProps => {'count': 0};

See: reactjs.org/docs/react-without-es6.html#declaring-default-props See: reactjs.org/docs/react-component.html#defaultprops

Implementation

@override
get defaultProps => (newProps()
  ..identicalErrorFrequencyTolerance = Duration(seconds: 5)
  // ignore: invalid_use_of_visible_for_testing_member
  ..loggerName = defaultErrorBoundaryLoggerName
  ..shouldLogErrors = true
);