mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: method channels
This commit is contained in:
16
lib/core/channel/bg_run.dart
Normal file
16
lib/core/channel/bg_run.dart
Normal 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');
|
||||
}
|
||||
}
|
||||
12
lib/core/channel/home_widget.dart
Normal file
12
lib/core/channel/home_widget.dart
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user