build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Calls the required Function object: Function(BuildContext context, T? object) and passes along the InheritWidget's custom 'object'

Implementation

@override
Widget build(BuildContext context) {
  /// Go up the widget tree and obtain the closest 'View'
  final _InheritedMVC? inheritWidget =
      context.dependOnInheritedWidgetOfExactType<_InheritedMVC>();
  final ViewMVC? state = inheritWidget?.state;
  if (state != null) {
    state
      ..setStates = true
      ..inBuilder = true
      .._rebuildAllowed = false;
  }
  final Object? object = inheritWidget?.object;
  final Widget widget = builder(context, object);
  if (state != null) {
    state
      .._rebuildAllowed = true
      ..inBuilder = false;
  }
  return widget;
}