cake_wallet/lib/entities/wake_lock.dart

22 lines
549 B
Dart
Raw Normal View History

2022-01-21 13:02:00 +00:00
import 'package:flutter/services.dart';
class WakeLock {
static const _utils = const MethodChannel('com.cake_wallet/native_utils');
Future<void> enableWake() async {
try {
await _utils.invokeMethod<String>('enableWakeScreen');
} on PlatformException catch (_) {
print('Failed enabling screen wakelock');
}
}
Future<void> disableWake() async {
try {
await _utils.invokeMethod<String>('disableWakeScreen');
} on PlatformException catch (_) {
print('Failed enabling screen wakelock');
}
}
}