of<T> static method

T of<T>(
  1. BuildContext? context, {
  2. Object? group,
  3. bool useNopGroup = true,
  4. int? position = 0,
})

Implementation

static T of<T>(BuildContext? context,
    {Object? group, bool useNopGroup = true, int? position = 0}) {
  assert(() {
    position = position == null ? null : position! + 1;
    return true;
  }());

  if (context == null) {
    return _getFromRouteOrCurrent(context,
        group: group, useNopGroup: useNopGroup, position: position);
  }

  return _NopState.getLocal(context, group, position) ??
      _getFromRouteOrCurrent<T>(context,
          group: group, useNopGroup: useNopGroup, position: position)!;
}