From 3dade05ef6cba00f802b9b4f73edfb94cb9b7f0d Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Thu, 27 May 2021 17:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/util/advertising_util.dart | 7 +++---- lib/util/application.dart | 18 +++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/util/advertising_util.dart b/lib/util/advertising_util.dart index f43f509..9822e1a 100644 --- a/lib/util/advertising_util.dart +++ b/lib/util/advertising_util.dart @@ -3,13 +3,12 @@ import 'package:flutter/cupertino.dart'; import 'application.dart'; class AdvertisingUtils { - static Future init() async { - await Application.doStringParamsMethod("init_advertising", data: {}); + static Future init() { + return Application.doStringParamsMethod("init_advertising", data: {}); //await Application.doStringParamsMethod("init_advertising", data: {"androidAppId": "5173995", "iosAppId": "5167929", "appName": "智莺生活"}); } static Future openSplashAd() async { - await Application.doStringParamsMethod("advertising_splash", data: {}); + return Application.doStringParamsMethod("advertising_splash", data: {}); } } - diff --git a/lib/util/application.dart b/lib/util/application.dart index 4db473d..d1f5aff 100644 --- a/lib/util/application.dart +++ b/lib/util/application.dart @@ -34,28 +34,28 @@ class Application { return _initStringMethods.containsKey(type); } - static doStringMethod(String type) { + static Future doStringMethod(String type) { if (_initStringMethods.containsKey(type)) { print("存在方法" + type); - _initStringMethods[type](); - } else { - print("不存在方法" + type); + return _initStringMethods[type](); } + print("不存在方法" + type); + return Future(() => false); } - static addStringParamsMethod({String type , StringParamsMethod method}) { + static addStringParamsMethod({String type, StringParamsMethod method}) { if (type == null || method == null) { return; } _initStringParamsMethods[type] = method; } - static doStringParamsMethod(String type, {Map data}) { + static Future doStringParamsMethod(String type, {Map data}) { if (_initStringParamsMethods.containsKey(type)) { print("存在方法" + type); - _initStringParamsMethods[type](data); - } else { - print("不存在方法" + type); + return _initStringParamsMethods[type](data); } + print("不存在方法" + type); + return Future(() => false); } }