Commit 9ba58020 authored by 汪林玲's avatar 汪林玲

增加null-safety,和引入说明

parent b452f696
{
"dart.flutterSdkPath": "/Users/qiaomeng/flutter_2.2.2",
}
\ No newline at end of file
Add your license here.
...@@ -42,4 +42,13 @@ await UmengCommonSdk.onEvent( ...@@ -42,4 +42,13 @@ await UmengCommonSdk.onEvent(
'key1': '测试上传数据', 'key1': '测试上传数据',
}, },
); );
```
### 引入说明
```
umeng_common_sdk:
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/umeng_common_flutter.git'
ref: 'null-safety'
``` ```
\ No newline at end of file
...@@ -12,12 +12,12 @@ class UmengCommonSdk { ...@@ -12,12 +12,12 @@ class UmengCommonSdk {
/// [channel] app的渠道,如:应用宝、小米、华为应用商店等 /// [channel] app的渠道,如:应用宝、小米、华为应用商店等
/// [enableLog] 是否启用日志 /// [enableLog] 是否启用日志
/// ///
static Future<bool> preInit({ static Future<bool?> preInit({
@required String appKey, required String appKey,
@required String channel, required String channel,
bool enableLog = false, bool enableLog = false,
}) async { }) async {
final bool result = await _channel.invokeMethod('preInit', { final bool? result = await _channel.invokeMethod('preInit', {
'appKey': appKey, 'appKey': appKey,
'channel': channel, 'channel': channel,
'enableLog': enableLog, 'enableLog': enableLog,
...@@ -34,11 +34,11 @@ class UmengCommonSdk { ...@@ -34,11 +34,11 @@ class UmengCommonSdk {
/// [mode] 页面采集模式,true:自动采集 false:手动采集 /// [mode] 页面采集模式,true:自动采集 false:手动采集
/// [process] 是否支持子进程采集数据, true:支持 false:不支持 /// [process] 是否支持子进程采集数据, true:支持 false:不支持
/// ///
static Future<bool> init({ static Future<bool?> init({
@required String appKey, required String appKey,
@required String channel, required String channel,
int deviceType = 1, int deviceType = 1,
String pushSecret, String? pushSecret,
bool mode = true, bool mode = true,
bool process = true, bool process = true,
}) async { }) async {
...@@ -58,9 +58,9 @@ class UmengCommonSdk { ...@@ -58,9 +58,9 @@ class UmengCommonSdk {
/// [event] 事件标志 /// [event] 事件标志
/// [properties] 事件参数 /// [properties] 事件参数
/// ///
static Future<bool> onEvent({ static Future<bool?> onEvent({
@required String event, required String event,
@required Map<String, dynamic> properties, required Map<String, dynamic> properties,
}) async { }) async {
return await _channel.invokeMethod('onEvent', { return await _channel.invokeMethod('onEvent', {
'eventId': event, 'eventId': event,
...@@ -73,9 +73,9 @@ class UmengCommonSdk { ...@@ -73,9 +73,9 @@ class UmengCommonSdk {
/// [userId] 用户标识 /// [userId] 用户标识
/// [provider] 账号来源。如果用户通过第三方账号登陆,微博,微信等 /// [provider] 账号来源。如果用户通过第三方账号登陆,微博,微信等
/// ///
static Future<bool> onSignIn({ static Future<bool?> onSignIn({
@required String userId, required String userId,
String provider, String? provider,
}) async { }) async {
return await _channel.invokeMethod('onSignIn', { return await _channel.invokeMethod('onSignIn', {
'userId': userId, 'userId': userId,
...@@ -86,7 +86,7 @@ class UmengCommonSdk { ...@@ -86,7 +86,7 @@ class UmengCommonSdk {
/// ///
/// 账号统计-退出登陆 /// 账号统计-退出登陆
/// ///
static Future<bool> onSignOff() async { static Future<bool?> onSignOff() async {
return await _channel.invokeMethod('onSignOff'); return await _channel.invokeMethod('onSignOff');
} }
...@@ -94,7 +94,7 @@ class UmengCommonSdk { ...@@ -94,7 +94,7 @@ class UmengCommonSdk {
/// 页面采集-打开 /// 页面采集-打开
/// [pageName] 采集页面的名称 /// [pageName] 采集页面的名称
/// ///
static Future<bool> onPageStart({@required String pageName}) async { static Future<bool?> onPageStart({required String pageName}) async {
return await _channel.invokeMethod('onPageStart', {'pageName': pageName}); return await _channel.invokeMethod('onPageStart', {'pageName': pageName});
} }
...@@ -102,7 +102,7 @@ class UmengCommonSdk { ...@@ -102,7 +102,7 @@ class UmengCommonSdk {
/// 页面采集关闭 /// 页面采集关闭
/// [pageName] 采集页面的名称 /// [pageName] 采集页面的名称
/// ///
static Future<bool> onPageEnd({@required String pageName}) async { static Future<bool?> onPageEnd({required String pageName}) async {
return await _channel.invokeMethod('onPageEnd', {'pageName': pageName}); return await _channel.invokeMethod('onPageEnd', {'pageName': pageName});
} }
} }
...@@ -4,7 +4,7 @@ version: 1.2.2 ...@@ -4,7 +4,7 @@ version: 1.2.2
homepage: https://www.umeng.com homepage: https://www.umeng.com
environment: environment:
sdk: '>=2.7.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.10.0" flutter: ">=1.10.0"
dependencies: dependencies:
......
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
const MethodChannel channel = MethodChannel('umeng_common_sdk');
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
return '42';
});
});
tearDown(() {
channel.setMockMethodCallHandler(null);
});
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment