pl method

String pl(
  1. String key, [
  2. Map<String, Object>? namedParameters
])

Calls l with the specified localizationKey.

For example, if localizationKey is pages.home and key is title, it is localized as pages.home.title. An assertion error occurs if localizationKey is not set.

Throws an exception if StandardPageWithResult does not exist in the widget tree of the context.

Implementation

String pl(
  String key, [
  Map<String, Object>? namedParameters,
]) {
  if (this is StatefulElement) {
    final tElement = (this as StatefulElement);
    if (tElement.state is StandardPageWithResult) {
      final tState = tElement.state as StandardPageWithResult;
      return tState.pl(key, namedParameters);
    }
  }

  return Provider.of<StandardPageWithResult>(this).pl(key, namedParameters);
}