IntlMessages class

Represents a message table with keys and values.

Constructors

IntlMessages.package(String packageName)
factory

Properties

currentLocale IntlLocale?
Returns the current resolved locales for this instance.
no setter
fallbackLanguages IntlFallbackLanguage
getter/setter pair
fallbackMessages IntlMessages?
getter/setter pair
hasAnyRegisteredLocalizedMessage bool
no setter
hashCode int
The hash code for this object.
no setterinherited
onRegisterLocalizedMessages → EventStream<String>
final
overrideMessages IntlMessages?
getter/setter pair
packageName String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

autoDiscover() Future<bool>
Starts auto discover process of resources and available locales.
autoDiscoverLocale(dynamic locale) Future<bool>
Auto discover a specific locale.
buildMsg(String key, [Map<String, dynamic>? variables]) String
Builds a message present in key using variables table in context.
clearMessages() → void
findAndRegisterMessagesResources(IntlResourceDiscover discover) Future<bool>
Finds with discover and register resolved IntlResourceContent.
findAndRegisterMessagesResourcesWithLocales(IntlResourceDiscover discover, List<String> locales) Future<bool>
Finds with discover using locales and register resolved IntlResourceContent.
getCurrentLocale() IntlLocale?
getFallbackLanguage(String language) String
getRegisteredIntLocales() List<IntlLocale>
Returns all registered IntlLocale
getRegisteredLocales() List<String>
Same as getRegisteredIntLocales, but as String.
hasRegisteredLocalizedMessage(dynamic locale) bool
initialize() → void
Initializes the messages an tries to discover available locales and resources.
isContentJSON(String content) bool
Identifies content with JSON format.
isContentProperties(String content) bool
Identifies content with properties format.
isContentYAML(String content) bool
Identifies content with YAML format.
key(String key, {Map<String, dynamic>? variables, IntlVariablesProvider? variablesProvider}) IntlKey
Returns a IntlKey for message key, with optional parameters variables or variablesProvider.
msg(String key, {Object? preferredLocale}) MessageBuilder
Get a message with key and returns a corresponding MessageBuilder.
msgAsString(String key, [Map<String, dynamic>? variables]) String
Return as message as String. Same as msg(key).build(variables).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerLocalizedMessages(LocalizedMessages localizedMessages) → void
Register messages for this instance.
registerMessages(dynamic locale, String content) bool
Register messages present in content document.
registerMessagesResource(Resource resource) Future<bool>
Register specific resource, without localized versions capability like IntlResourceContent.
registerMessagesResourceContent(IntlResourceContent resource) Future<bool>
Register resolved resource.
registerMessagesResourcePath(String resourcePath) Future<bool>
Register a specific resourcePath, without localized versions capability like IntlResourceContent.
registerMessagesResources(List<Resource> resources) Future<bool>
Register resources, without localized versions capability like IntlResourceContent.
registerMessagesResourcesContents(List<IntlResourceContent> resources) Future<bool>
Register resolved resources.
registerResourceDiscover(IntlResourceDiscover discover, {bool allowAutoDiscover = true}) Future<bool>
Register a discover for resources.
setLocale(dynamic locale) FutureOr<bool>
Sets the main locale for this instance.
toString() String
A string representation of this object.
override
unregisterResourceDiscover(IntlResourceDiscover discover) bool

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String key) MessageBuilder

Static Properties

instances Map<String, IntlMessages>
getter/setter pair
onRegisterLocalizedMessagesGlobal → EventStream<String>
final

Static Methods

normalizePackageName(String packageName) String

Constants

VERSION → const String