ConfigFile class

ConfigFile is a class that helps you to create JSON config files easily.

Implementers

Constructors

ConfigFile(File file, Map<String, dynamic> defaultValue, {List<String> route = const []})

Properties

data Map<String, dynamic>
The config data.
getter/setter pair
defaultValue Map<String, dynamic>
The default config data.
final
file File
The file that stores the config data.
final
hashCode int
The hash code for this object.
no setterinherited
route List<String>
The JSON route to the current path.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete({String? key}) ConfigFile
Delete key from JSON object.
exists() bool
Check if the current path exists.
get(List<String> keys) PathResolver
Get PathResolver instance of the path.
getObjectFromPath() Map
Get the JSON object at the current path.
getPreObjectFromPath() Map
Get the parent JSON object of the current path.
getValue([String? key]) → dynamic
Get value from JSON object. If key is not provided, return the value at current path.
has(String key) bool
Check if the key exists in the JSON object.
load() Future<ConfigFile>
Load the config data from the file.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetData() ConfigFile
Reset the config data to the default value.
resetPath() ConfigFile
Clear the stored route. This means that you can get the root ConfigFile instance.
save({bool compact = false}) Future<ConfigFile>
Save the config data to the file.
set({String? key, dynamic value}) ConfigFile
Set value to JSON object.
toString() String
A string representation of this object.
inherited

Operators

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