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(
'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 {
/// [channel] app的渠道,如:应用宝、小米、华为应用商店等
/// [enableLog] 是否启用日志
///
static Future<bool> preInit({
@required String appKey,
@required String channel,
static Future<bool?> preInit({
required String appKey,
required String channel,
bool enableLog = false,
}) async {
final bool result = await _channel.invokeMethod('preInit', {
final bool? result = await _channel.invokeMethod('preInit', {
'appKey': appKey,
'channel': channel,
'enableLog': enableLog,
......@@ -34,11 +34,11 @@ class UmengCommonSdk {
/// [mode] 页面采集模式,true:自动采集 false:手动采集
/// [process] 是否支持子进程采集数据, true:支持 false:不支持
///
static Future<bool> init({
@required String appKey,
@required String channel,
static Future<bool?> init({
required String appKey,
required String channel,
int deviceType = 1,
String pushSecret,
String? pushSecret,
bool mode = true,
bool process = true,
}) async {
......@@ -58,9 +58,9 @@ class UmengCommonSdk {
/// [event] 事件标志
/// [properties] 事件参数
///
static Future<bool> onEvent({
@required String event,
@required Map<String, dynamic> properties,
static Future<bool?> onEvent({
required String event,
required Map<String, dynamic> properties,
}) async {
return await _channel.invokeMethod('onEvent', {
'eventId': event,
......@@ -73,9 +73,9 @@ class UmengCommonSdk {
/// [userId] 用户标识
/// [provider] 账号来源。如果用户通过第三方账号登陆,微博,微信等
///
static Future<bool> onSignIn({
@required String userId,
String provider,
static Future<bool?> onSignIn({
required String userId,
String? provider,
}) async {
return await _channel.invokeMethod('onSignIn', {
'userId': userId,
......@@ -86,7 +86,7 @@ class UmengCommonSdk {
///
/// 账号统计-退出登陆
///
static Future<bool> onSignOff() async {
static Future<bool?> onSignOff() async {
return await _channel.invokeMethod('onSignOff');
}
......@@ -94,7 +94,7 @@ class UmengCommonSdk {
/// 页面采集-打开
/// [pageName] 采集页面的名称
///
static Future<bool> onPageStart({@required String pageName}) async {
static Future<bool?> onPageStart({required String pageName}) async {
return await _channel.invokeMethod('onPageStart', {'pageName': pageName});
}
......@@ -102,7 +102,7 @@ class UmengCommonSdk {
/// 页面采集关闭
/// [pageName] 采集页面的名称
///
static Future<bool> onPageEnd({@required String pageName}) async {
static Future<bool?> onPageEnd({required String pageName}) async {
return await _channel.invokeMethod('onPageEnd', {'pageName': pageName});
}
}
......@@ -4,7 +4,7 @@ version: 1.2.2
homepage: https://www.umeng.com
environment:
sdk: '>=2.7.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.10.0"
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