Locales.from constructor

Locales.from(
  1. Object? source
)

Implementation

factory Locales.from(Object? source) {
  if (source is! Map || source.isEmpty) return const Locales();
  final name = source["name"];
  final native = source["native"];
  final code = source["code"];
  final c = code is String ? code : "en_US";
  return Locales(
    name: name is String ? name : "English",
    native: native is String ? native : "English",
    code: c,
    locale: parse(c),
  );
}