Last active
October 7, 2018 12:48
-
-
Save rohan20/6996383aa7b5eef8e7cdef98c44a80de to your computer and use it in GitHub Desktop.
flutter-localizations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:ui'; | |
class Application { | |
static final Application _application = Application._internal(); | |
factory Application() { | |
return _application; | |
} | |
Application._internal(); | |
final List<String> supportedLanguages = [ | |
"English", | |
"Spanish", | |
]; | |
final List<String> supportedLanguagesCodes = [ | |
"en", | |
"es", | |
]; | |
//returns the list of supported Locales | |
Iterable<Locale> supportedLocales() => | |
supportedLanguagesCodes.map<Locale>((language) => Locale(language, "")); | |
//function to be invoked when changing the language | |
LocaleChangeCallback onLocaleChanged; | |
} | |
Application application = Application(); | |
typedef void LocaleChangeCallback(Locale locale); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment