of static method

Finds the RebuildableState from the closest instance of this class that encloses the given context.

Implementation

static RebuildableAppState of(BuildContext context) {
  final RebuildableAppState? result =
      context.findAncestorStateOfType<RebuildableAppState>();

  assert(
    result != null,
    "The result is null. Consider calling the maybeOf function.",
  );
  return result!;
}