ConfigParser class

A parser for searching for a configuration. The pattern is used to match against the file name. The getConfig function is used to parse the configuration file contents. The fs is the file system to use to read the configuration file (defaults to the local file system).

Constructors

ConfigParser(Pattern pattern, FutureOr<Map<String, dynamic>?> getConfig(String name, String path, String contents), {FileSystem fs = const LocalFileSystem()})
const

Properties

fs → FileSystem
The file system to use to read the configuration file.
final
getConfig FutureOr<Map<String, dynamic>?> Function(String name, String path, String contents)
The function to use to parse the configuration file contents.
final
hashCode int
The hash code for this object.
no setterinherited
pattern Pattern
The regular expression to match against the file name.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({Pattern? pattern, FutureOr<Map<String, dynamic>?> getConfig(String name, String path, String contents)?, FileSystem? fs}) ConfigParser
Create a copy of the parser with the given parameters.
matches(String path) bool
Whether the parser matches the file name.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
Search for the configuration in the file at path.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

loadYamlAsMap(String contents) Map<String, dynamic>
Load a YAML string as a native (Dart) map. Returns an empty map if the YAML is invalid.
yamlMapToMap(YamlMap yaml) Map<String, dynamic>
Convert a YAML map to a native (Dart) map.