StateMVC<T extends StatefulWidget> constructor

StateMVC<T extends StatefulWidget>([
  1. ControllerMVC? _controller
])

With an optional Controller parameter, this constructor imposes its own Error Handler.

Implementation

StateMVC([this._controller]) : currentErrorFunc = FlutterError.onError {
  /// If a tester is running. Don't switch out its error handler.
  /// WidgetsBinding.instance is WidgetsFlutterBinding
  if (WidgetsBinding.instance == null ||
      WidgetsBinding.instance is WidgetsFlutterBinding) {
    /// This allows one to place a breakpoint at 'onError(details)' to determine error location.
    FlutterError.onError = onError;
  } else {
    _inTester = WidgetsBinding.instance is TestWidgetsFlutterBinding;
  }

  /// IMPORTANT! Assign itself to stateView before adding any Controller. -gp
  /// Any subsequent calls to add() will be assigned, stateMVC.
  _stateMVC = this;
  add(_controller);
}