Flutter OHOS fluttertpc_device_util
fluttertpc_device_util
鸿蒙设备工具类
Flutter 代码调用
创建通道
static const MethodChannel _channel = const MethodChannel('device_util');
获取 version name
/// The version name of this application static Future<Stringget versionName async { final String version = await _channel.invokeMethod('getVersionName'); return version; }
获取 version code
/// The version code name of this application static Future<Stringget versionCode async { final String version = await _channel.invokeMethod('getVersionCode'); return version; }
打开手机的网络设置页面
/// Open the phone's network settings page static Future<NullopenNetworkSettingPage() async { await _channel.invokeMethod('launchNoNetwork'); }
打开手机设置页面
/// Open the settings page of the currently running application static Future<NullopenApplicationSettingPage() async { await _channel.invokeMethod('systemSettingPage'); }
获取手机信息
static Future<Map<String, String>get getChannelInfo async { final Map<String, StringchannelInfo = Map<String, String>.from(await _channel.invokeMethod('getChannelInfo')); return channelInfo; }
终止当前应用程序进程并退出
/// Kill the current application process and exit (Only supports Android) static Future<NullkillApp() async { await _channel.invokeMethod('killApp'); }
####鸿蒙 OS 代码
复制代码
评论