currentTimezone property
Fetches the current IANA timezone name from the native platform.
Implementation
@override
Future<String> get currentTimezone async {
try {
final timezone =
await _methodChannel.invokeMethod('getLocalTimezone') as String?;
return timezone ?? 'unknown';
} on PlatformException catch (e, st) {
log(
'Failed to get timezone. Platform error.',
name: 'FlutterTimezoneObserver',
error: e,
stackTrace: st,
);
return 'unknown';
}
}