recreateIntlObjects function

BasicTranslatedMessage recreateIntlObjects(
  1. String id,
  2. dynamic data
)

Regenerate the original IntlMessage objects from the given data. For things that are messages, we expect id not to start with "@" and data to be a String. For metadata we expect id to start with "@" and data to be a Map or null. For metadata we return null.

Implementation

BasicTranslatedMessage recreateIntlObjects(String id, data) {
  if (id.startsWith("@")) return null;
  if (data == null) return null;
  var parsed = _pluralAndGenderParser.parse(data).value;
  if (parsed is LiteralString && parsed.string.isEmpty) {
    parsed = _plainParser.parse(data).value;
  }
  return BasicTranslatedMessage(id, parsed);
}