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

19 lines
477 B
Dart
Raw Normal View History

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