aves/lib/services/time_service.dart
2021-05-13 19:34:23 +09:00

20 lines
592 B
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
abstract class TimeService {
Future<String?> getDefaultTimeZone();
}
class PlatformTimeService implements TimeService {
static const platform = MethodChannel('deckers.thibault/aves/time');
@override
Future<String?> getDefaultTimeZone() async {
try {
return await platform.invokeMethod('getDefaultTimeZone');
} on PlatformException catch (e) {
debugPrint('getDefaultTimeZone failed with code=${e.code}, exception=${e.message}, details=${e.details}');
}
return null;
}
}