getController<Con extends Controller> static method

Con getController<Con extends Controller>(
  1. BuildContext context, {
  2. bool listen = true,
})

Retrieves a Controller from the widget tree if one exists Can be used in widgets that exist in pages and need to use the same controller

Implementation

static Con getController<Con extends Controller>(BuildContext context,
    {bool listen = true}) {
  return Provider.of<Con>(context, listen: listen);
}