of static method

Access the nearest NotificationCenter state.

Implementation

static NotificationCenterState of(BuildContext context) {
  final NotificationCenterState? state =
      context.findAncestorStateOfType<NotificationCenterState>();
  assert(state != null, 'NotificationCenter not found in widget tree.');
  return state!;
}