mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
21 lines
545 B
Dart
21 lines
545 B
Dart
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<bool>('enableWakeScreen');
|
|
} on PlatformException catch (_) {
|
|
print('Failed enabling screen wakelock');
|
|
}
|
|
}
|
|
|
|
Future<void> disableWake() async {
|
|
try {
|
|
await _utils.invokeMethod<bool>('disableWakeScreen');
|
|
} on PlatformException catch (_) {
|
|
print('Failed enabling screen wakelock');
|
|
}
|
|
}
|
|
}
|