DartConfigParser class final

DartConfigParser - improved to accept any constructor/static factory that produces a JetleafProperty (heuristic-based), not only JetleafProperty.custom.

Strategy:

  1. Remove comments (but preserve strings).
  2. Collect class names in the source that extends JetleafProperty.
  3. Find classes that extends ConfigurationProperty and extract the ConfigurationProperties({...}) block inside their properties() method.
  4. Parse the map content; accept any call expression whose callee looks like:
    • 'JetleafProperty' (static factory)
    • a declared subclass found in step 2
    • an identifier that starts with uppercase or ends with 'Property' and whose first argument is a string literal (the key).

Example

class MyProperty extends JetleafProperty {
  MyProperty(String key) : super(key);
}

class MyConfig {
  final MyProperty myProperty;
  MyConfig(this.myProperty);
}

Constructors

DartConfigParser()
DartConfigParser - improved to accept any constructor/static factory that produces a JetleafProperty (heuristic-based), not only JetleafProperty.custom.

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
parse(String source) → Map<String, dynamic>
Parses the given source code and returns a map of properties.
toString() → String
A string representation of this object.
inherited

Operators

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