opt.: method channels

This commit is contained in:
lollipopkit
2023-09-16 16:56:11 +08:00
parent c07958fa73
commit 2a6c2f7c72
5 changed files with 34 additions and 9 deletions

View File

@@ -0,0 +1,16 @@
import 'package:flutter/services.dart';
import 'package:toolbox/data/res/misc.dart';
class BgRunMC {
const BgRunMC._();
static const _channel = MethodChannel('${Miscs.pkgName}/app_retain');
static void moveToBg() {
_channel.invokeMethod('sendToBackground');
}
static void startService() {
_channel.invokeMethod('startService');
}
}

View File

@@ -0,0 +1,12 @@
import 'package:flutter/services.dart';
import 'package:toolbox/data/res/misc.dart';
class HomeWidgetMC {
const HomeWidgetMC._();
static const _channel = MethodChannel('${Miscs.pkgName}/home_widget');
static void update() {
_channel.invokeMethod('update');
}
}