of static method

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

Implementation

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

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