Reads a .properties Resource into a map of keys to values in one
call.
Use it when the properties are data for your code rather than
configuration, such as a mapping table shipped in lib/resources/; for
configuration, put the file in the environment instead (a config file,
@PropertySource or ResourcePropertySource).
// Country names shipped with the application.
final countries = await PropertiesLoaderUtils.loadProperties(
resourceLoader.getResource('resources:countries.properties'),
);
Spring (Java):
Properties countries = PropertiesLoaderUtils.loadProperties(
new ClassPathResource("countries.properties"));
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
loadProperties(
Resource resource, {Encoding encoding = utf8}) → Future< Map< String, String> > -
Reads
resource, decoded withencoding(UTF-8 unless given), and parses it. Works for every resource, including Flutter assets. -
loadPropertiesSync(
Resource resource, {Encoding encoding = utf8}) → Map< String, String> -
Reads
resourcewithout waiting, decoded withencoding, and parses it. Throws UnsupportedError for a resource that can only be read asynchronously.