mirror of
https://github.com/krawieck/lemmur/
synced 2024-12-17 02:48:47 +01:00
18 lines
398 B
Dart
18 lines
398 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
export 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
export 'l10n_from_string.dart';
|
|
|
|
abstract class LocaleSerde {
|
|
static Locale fromJson(String json) {
|
|
if (json == null) return null;
|
|
|
|
final lang = json.split('-');
|
|
|
|
return Locale(lang[0], lang.length > 1 ? lang[1] : null);
|
|
}
|
|
|
|
static String toJson(Locale locale) => locale.toLanguageTag();
|
|
}
|