APIConfig class

The API Configuration.

Constructors

APIConfig([Map<String, dynamic> properties = const <String, dynamic>{}])
APIConfig.fromJson(Map<String, dynamic> json)
Constructs an APIConfig from json.
APIConfig.fromJsonEncoded(String jsonEncoded)
Constructs an APIConfig from jsonEncoded.
APIConfig.fromPropertiesEncoded(String properties)
Constructs an APIConfig from properties.
APIConfig.fromYAML(String yamlEncoded)
Constructs an APIConfig from a yamlEncoded.
factory

Properties

development bool
If true indicates development environment.
latefinal
entries Iterable<MapEntry<String, dynamic>>
The properties entries.
no setter
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Returns true if the configuration properties is empty.
no setter
isNotEmpty bool
same as: ![isNotEmpty].
no setter
keys Iterable<String>
The properties keys.
no setter
length int
The number of the properties entries.
no setter
properties Map<String, dynamic>
Returns a unmodifiable Map of the configuration properties.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source String?
The source of this configuration.
no setter
sourceParentPath String?
The source parent path of this configuration.
no setter
test bool
If true indicates test environment.
latefinal
values Iterable
The properties values.
no setter

Methods

applyProperties() Map<String, String>?
Apply the values in the properties entry to the APIPlatform properties.
get(String key, {Object? defaultValue, bool caseSensitive = false}) → dynamic
properties key getter.
getAs<T>(String key, {T? defaultValue, bool caseSensitive = false}) → T?
Alias to get returning as T. If not null, it attempts to parse the value into T or throws a StateError.
getAsList<E>(String key, {List<E>? defaultValue, bool caseSensitive = false}) List<E>?
Alias to get returning a List.
getAsMap<V>(String key, {Map<String, V>? defaultValue, bool caseSensitive = false}) Map<String, V>?
Alias to get returning a Map.
getIgnoreCase(String key, {Object? defaultValue}) → dynamic
properties case insensitive key getter.
getPath<E>(String k0, [Object? k1, Object? k2, Object? k3, Object? k4]) → E?
Returns the final value from a path of keys as E. If not null, it attempts to parse the value into E or throws a StateError.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson({bool maskField(String key)?}) Map<String, dynamic>
Converts this configuration properties to a JSON Map.
toJsonEncoded({bool maskField(String key)?, bool pretty = true}) String
Converts this configuration properties to an encoded JSON.
toPropertiesEncoded() String
Converts this configuration properties to a Java properties format.
toString() String
A string representation of this object.
override
toYAMLEncoded() String
Converts this configuration properties to an encoded YAML.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String key) → dynamic
properties key getter.
operator []=(String key, dynamic value) → void
properties key setter.

Static Methods

from(dynamic o, [dynamic def]) APIConfig?
Constructs an APIConfig instance from o, returning def if o is invalid. Calls fromSync.
fromAsync(dynamic o, [dynamic def]) FutureOr<APIConfig?>
Constructs an APIConfig instance from o, returning def if o is invalid. (Async mode, allows async calls like URL resolution).
fromCollection(Object? o, [dynamic def]) APIConfig?
Constructs an APIConfig instance from a collection o, or return def.
fromContent(String content, {String? type, bool autoIdentify = true, String? source}) APIConfig?
Tries to construct an APIConfig from content.
fromSync(dynamic o, [dynamic def]) APIConfig?
Constructs an APIConfig instance from o, returning def if o is invalid. (Sync mode).
fromUri(Uri uri, {bool allowAsync = true}) FutureOr<APIConfig?>
Constructs an APIConfig instance from an [uri If allowAsync ir true allows async resolution, like URL download.
parsePropertiesEncoded(String properties) Map<String, dynamic>
parsePropertiesEncodedEntries(String properties) List<MapEntry<String, dynamic>>
resolveFileExtension(String path) String?
Tries to resolve a file extension from path.
resolveStringUri(String s) Uri?
Tries to resolves a String s to an Uri.