GettextLocalizations.fromBytes constructor

GettextLocalizations.fromBytes(
  1. List<int> bytes, {
  2. OnWarning? onWarning = print,
})

Write the translations from raw PO file bytes to the Gettext instance.

Decoding the bytes happens on the main isolate, which keeps loading usable inside flutter_test (unlike rootBundle.loadString, which offloads large assets to a background isolate).

See GettextLocalizations.fromPO for the onWarning behavior.

Implementation

GettextLocalizations.fromBytes(
  List<int> bytes, {
  OnWarning? onWarning = print,
}) : _gt = Gettext(onWarning: onWarning) {
  _gt.addLocale(po.parseBytes(bytes));
}