buildContext static method

BuildContext buildContext([
  1. BuildContext? context
])

Returns either the provided context or the globally registered fallback.

Implementation

static BuildContext buildContext([BuildContext? context]) {
  final resolved =
      context ?? instance._navigatorKey?.currentContext ?? instance._context;
  if (resolved == null) {
    throw StateError(
      'Call DraftModeUIContext.init(navigatorKey: ...) or '
      'DraftModeUIContext.init(context: ...)',
    );
  }
  return resolved;
}