importJson method
Imports a theme configuration from JSON.
Returns true when the configuration was successfully imported.
Invalid JSON or invalid theme data returns false and leaves the
current configuration unchanged.
Implementation
Future<bool> importJson(String json) async {
try {
final importedConfig = _json.decode(json);
final mergedConfig = _mergeConfigurations(_baseConfig, importedConfig);
_config = mergedConfig;
await _storage.save(_config);
notifyListeners();
return true;
} on FormatException {
return false;
} on Object {
return false;
}
}