context property

BuildContext get context

The BuildContext of the nearest ControllerProvider ancestor.

This can be used to access inherited widgets and perform navigation. Throws an assertion error if accessed before the controller is initialized.

Implementation

BuildContext get context {
  assert(_context != null, 'Context accessed before initialization');
  return _context!;
}
  1. @protected
set context (BuildContext value)

Sets the BuildContext for this controller. This is called internally by ControllerProvider.

Implementation

@protected
set context(BuildContext value) => _context = value;