debugCheckHasTimetableLocalizations function

bool debugCheckHasTimetableLocalizations(
  1. BuildContext context
)

Implementation

bool debugCheckHasTimetableLocalizations(BuildContext context) {
  assert(() {
    final localizations = Localizations.of<TimetableLocalizations>(
      context,
      TimetableLocalizations,
    );
    if (localizations == null) {
      throw FlutterError.fromParts(<DiagnosticsNode>[
        ErrorSummary('No TimetableLocalization found.'),
        ErrorDescription(
          '${context.widget.runtimeType} widgets require TimetableLocalization '
          'to be provided by a Localizations widget ancestor.',
        ),
        ErrorDescription(
          'The timetable library uses Localizations to generate messages, '
          'labels, and abbreviations.',
        ),
        ErrorHint(
          'To introduce a TimetableLocalization, add a '
          'TimetableLocalizationsDelegate() to your '
          "Material-/Cupertino-/WidgetApp's localizationsDelegates.",
        ),
        ...context.describeMissingAncestor(
          expectedAncestorType: TimetableLocalizations,
        ),
      ]);
    }
    return true;
  }());
  return true;
}