created settings model
This commit is contained in:
29
lib/model/settings.dart
Normal file
29
lib/model/settings.dart
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import '../assets/constants.dart' as constants;
|
||||||
|
|
||||||
|
class Settings {
|
||||||
|
final String exportDirectoryPath;
|
||||||
|
|
||||||
|
Settings._({required this.exportDirectoryPath});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {'exportDirectoryPath': exportDirectoryPath};
|
||||||
|
}
|
||||||
|
|
||||||
|
factory Settings.fromJson(Map<String, dynamic> json) {
|
||||||
|
return Settings._(
|
||||||
|
exportDirectoryPath: json['exportDirectoryPath'] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
factory Settings.defaults() {
|
||||||
|
return Settings._(
|
||||||
|
exportDirectoryPath: constants.defaultAndroidExportDirectory,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings copyWith({String? exportDirectoryPath}) {
|
||||||
|
return Settings._(
|
||||||
|
exportDirectoryPath: exportDirectoryPath ?? this.exportDirectoryPath,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user