Languages

Languages

The package includes 185+ languages with ISO 639-1 codes.

Language Properties

Each language has the following fields:

FieldDescription
codeISO 639-1 language code (e.g. "en")
nativeNameName in the language itself (e.g. "English")
dialectsList of language dialects
defaultFlagCodeCountry code for a representative flag

Each dialect has:

FieldDescription
codeDialect code
nativeNameNative name of the dialect
flagCodeCountry code for the dialect's flag

Lookup by Code

final lang = Language.fromCode('en');
print(lang?.nativeName); // English
print(lang?.code);       // en

List All Languages

final allLanguages = Language.values;
print(allLanguages.length); // 187

Dialects

Languages can have dialects representing regional variations.

final lang = Language.fromCode('en');
if (lang != null) {
  for (final d in lang.dialects) {
    print('${d.nativeName} (${d.flagCode})');
  }
}

Language Flags

Languages can have a representative flag based on their default flag code.

final lang = Language.fromCode('fr');
final svg = lang?.flagSvg; // SVG string or null

Type-Safe Language Codes

print(Language.french.nativeName); // Fran??ais
print(Language.french.code);       // fr