debugCheckHasTxLocalizations function

bool debugCheckHasTxLocalizations(
  1. BuildContext context
)

Implementation

bool debugCheckHasTxLocalizations(BuildContext context) {
  assert(() {
    if (Localizations.of<TxLocalizations>(context, TxLocalizations) == null) {
      throw FlutterError.fromParts(<DiagnosticsNode>[
        ErrorSummary('No TxLocalizations found.'),
        ErrorDescription(
          '${context.widget.runtimeType} widgets require TxLocalizations '
          'to be provided by a Localizations widget ancestor.',
        ),
        ErrorDescription(
          'The material library uses Localizations to generate messages, '
          'labels, and abbreviations.',
        ),
        ErrorHint(
          'To introduce a TxLocalizations, either use a '
          'MaterialApp at the root of your application to include them '
          'automatically, or add a Localization widget with a '
          'TxLocalizations delegate.',
        ),
        ...context.describeMissingAncestor(
            expectedAncestorType: TxLocalizations),
      ]);
    }
    return true;
  }());
  return true;
}