selfprivacy.org.app/lib/logic/models/timezone_settings.dart

19 lines
477 B
Dart
Raw Normal View History

2022-02-07 07:53:13 +00:00
import 'package:timezone/timezone.dart';
class TimeZoneSettings {
2022-06-05 19:36:32 +00:00
factory TimeZoneSettings.fromString(final String string) {
final Location location = timeZoneDatabase.locations[string]!;
2022-09-12 17:38:22 +00:00
return TimeZoneSettings(timezone: location);
2022-06-05 19:36:32 +00:00
}
2022-02-07 07:53:13 +00:00
2022-09-12 17:38:22 +00:00
TimeZoneSettings({this.timezone});
final Location? timezone;
2022-02-07 07:53:13 +00:00
2022-06-05 19:36:32 +00:00
Map<String, dynamic> toJson() => {
2022-09-12 17:38:22 +00:00
'timezone': timezone?.name ?? 'Unknown',
};
2022-09-12 17:38:22 +00:00
@override
String toString() => timezone?.name ?? 'Unknown';
2022-02-07 07:53:13 +00:00
}