import 'dart:async'; import 'dart:io'; import 'package:flutter/services.dart'; class Min { static const MethodChannel _channel = const MethodChannel('min'); static Future isInitialize() async { return await _channel.invokeMethod('isInitialize'); } static Future isExistsApp(appid) async { return await _channel .invokeMethod('isExistsApp', {"appid": appid}); } static Future getAppVersionInfo(appid) async { final String version = await _channel.invokeMethod('getAppVersionInfo', {"appid": appid}); return version; } static Future getAppBasePath(appid) async { if(Platform.isIOS) { final String getAppBasePath = await _channel.invokeMethod( 'getAppBasePath', {"appid": appid} ); return getAppBasePath; } else { final String getAppBasePath = await _channel.invokeMethod( 'getAppBasePath', ); return getAppBasePath; } } static Future runingAppid() async { final String runingAppid = await _channel.invokeMethod( 'runingAppid', ); return runingAppid; } static Future currentPageUrl() async { final String currentPageUrl = await _channel.invokeMethod( 'currentPageUrl', ); return currentPageUrl; } static Future closeCurrentApp() async { final bool isExists = await _channel.invokeMethod('closeCurrentApp'); return isExists; } static Future initialize() async { final bool isInit = await _channel.invokeMethod('initialize'); return isInit; } static startMin(appid, json) async { _channel.invokeMethod( 'startMin', {"appid": appid, "json": json}); } static Future reloadWgt(appid, wgtPath) async { final bool isReload = await _channel.invokeMethod( 'reloadWgt', {"appid": appid, "wgtPath": wgtPath}); return isReload; } static clickListener() { _channel.invokeMethod('clickListener'); } }