Some checks failed
Flutter APK Build / Build Flutter APK (pull_request) Has been cancelled
40 lines
1.0 KiB
Dart
40 lines
1.0 KiB
Dart
import '../assets/constants.dart' as constants;
|
|
|
|
class Settings {
|
|
final String exportDirectoryPath;
|
|
final bool alwaysExportEnabled;
|
|
|
|
Settings._({
|
|
required this.exportDirectoryPath,
|
|
required this.alwaysExportEnabled,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'exportDirectoryPath': exportDirectoryPath,
|
|
'alwaysExportEnabled': alwaysExportEnabled,
|
|
};
|
|
}
|
|
|
|
factory Settings.fromJson(Map<String, dynamic> json) {
|
|
return Settings._(
|
|
exportDirectoryPath: json['exportDirectoryPath'] as String,
|
|
alwaysExportEnabled: json['alwaysExportEnabled'] as bool,
|
|
);
|
|
}
|
|
|
|
factory Settings.defaults() {
|
|
return Settings._(
|
|
exportDirectoryPath: constants.defaultAndroidExportDirectory,
|
|
alwaysExportEnabled: false,
|
|
);
|
|
}
|
|
|
|
Settings copyWith({String? exportDirectoryPath, bool? alwaysExportEnabled}) {
|
|
return Settings._(
|
|
exportDirectoryPath: exportDirectoryPath ?? this.exportDirectoryPath,
|
|
alwaysExportEnabled: alwaysExportEnabled ?? this.alwaysExportEnabled,
|
|
);
|
|
}
|
|
}
|