toMap method

JsonObjectMap toMap()

Converts the NaturalLanguage object to a JSON map.

The returned map contains the following keys:

  • "name": A string that represents the name of the language.
  • "code": A string that represents the ISO 639-1 code of the language.
  • "codeShort": A string that represents the short code of the language.
  • "namesNative": A string that represents the native names of the language.
  • "family": A string that represents the name of the language family.
  • "isRightToLeft": A boolean that indicates whether the language is written from right to left.
  • "scripts": A string that represents the scripts of the language.

Example usage:

final jsonMap = LangEng().toMap();

Implementation

JsonObjectMap toMap() => {
  "bibliographicCode": bibliographicCode,
  "code": code,
  "codeShort": codeShort,
  "family": family.name,
  "isRightToLeft": isRightToLeft,
  "name": name,
  "namesNative": namesNative,
  "scripts": scripts.toIsoList(),
  "translations": translations
      .map((l10n) => l10n.toMap())
      .toList(growable: false),
};