setValueAtPath method
Write a nested value to settings.
Implementation
@override
SettingValidation setValueAtPath(List<String> path, dynamic value) {
if (path.isEmpty) {
return const SettingValidation.invalid('Invalid setting path');
}
Map<String, dynamic> current = _data;
for (var i = 0; i < path.length - 1; i++) {
final key = path[i];
if (!current.containsKey(key) || current[key] is! Map) {
current[key] = <String, dynamic>{};
}
current = current[key] as Map<String, dynamic>;
}
current[path.last] = value;
return const SettingValidation.valid();
}