Commit d700618d authored by 汪林玲's avatar 汪林玲

增加null-safety,和引入说明

parent 07671352
## 0.0.1
* TODO: Describe initial release.
TODO: Add your license here.
......@@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.0-nullsafety.1"
version: "2.8.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.15.0-nullsafety.3"
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
......@@ -66,21 +66,21 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10-nullsafety.1"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.1"
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
......@@ -92,49 +92,49 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.2"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0-nullsafety.1"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.19-nullsafety.2"
version: "0.4.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
umeng_crash:
dependency: "direct main"
description:
......@@ -148,7 +148,7 @@ packages:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
sdks:
dart: ">=2.10.0-110 <2.11.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.22.0"
......@@ -12,11 +12,11 @@ class UmengCrash {
/// [appKey] 友盟控制台的appKey
/// [channel] 渠道:应用宝、小米应用商店、appstore等
///
static Future<bool> preInit({
@required String appKey,
@required String channel,
static Future<bool?> preInit({
required String appKey,
required String channel,
}) async {
final bool result = await _channel
final bool? result = await _channel
.invokeMethod('preInit', {'appKey': appKey, 'channel': channel});
return result;
}
......@@ -28,13 +28,13 @@ class UmengCrash {
/// [deviceType] 设备类型 1、手机 2、android机顶盒等
/// [pushSecret] 推送密钥
///
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,
}) async {
final bool result = await _channel.invokeMethod('init', {
final bool? result = await _channel.invokeMethod('init', {
'appKey': appKey,
'channel': channel,
'deviceType': deviceType,
......@@ -49,12 +49,12 @@ class UmengCrash {
/// [subVersion] 发布类型, "release",
/// [buildId] 版本id, "0001"
///
static Future<bool> setAppVersion({
@required String version,
@required String subVersion,
@required String buildId,
static Future<bool?> setAppVersion({
required String version,
required String subVersion,
required String buildId,
}) async {
final bool result = await _channel.invokeMethod('setAppVersion', {
final bool? result = await _channel.invokeMethod('setAppVersion', {
'version': version,
'subVersion': subVersion,
'buildId': buildId,
......@@ -67,11 +67,11 @@ class UmengCrash {
/// [e] 异常信息
/// [type] 异常类型
///
static Future<bool> generateCustomLog({
@required String e,
@required String type,
static Future<bool?> generateCustomLog({
required String e,
required String type,
}) async {
final bool result = await _channel.invokeMethod('generateCustomLog', {
final bool? result = await _channel.invokeMethod('generateCustomLog', {
'e': e,
'type': type,
});
......@@ -82,21 +82,21 @@ class UmengCrash {
/// 程序退出时,用于保存统计数据的API。
/// 如果开发者调用kill或者exit之类的方法杀死进程,或者双击back键会杀死进程,请务必在此之前调用onKillProcess方法,用来保存统计数据。
///
static Future<bool> onKillProcess() async {
final bool result = await _channel.invokeMethod('onKillProcess');
static Future<bool?> onKillProcess() async {
final bool? result = await _channel.invokeMethod('onKillProcess');
return result;
}
///
/// 可选
///
static Future<String> get getOaid async {
final String version = await _channel.invokeMethod('getOaid');
static Future<String?> get getOaid async {
final String? version = await _channel.invokeMethod('getOaid');
return version;
}
static Future<String> get platformVersion async {
final String version = await _channel.invokeMethod('getPlatformVersion');
static Future<String?> get platformVersion async {
final String? version = await _channel.invokeMethod('getPlatformVersion');
return version;
}
}
......@@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.0-nullsafety.1"
version: "2.8.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.15.0-nullsafety.3"
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
......@@ -66,21 +66,21 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10-nullsafety.1"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.1"
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
......@@ -92,56 +92,56 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.2"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0-nullsafety.1"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.19-nullsafety.2"
version: "0.4.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
sdks:
dart: ">=2.10.0-110 <2.11.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.22.0"
......@@ -4,7 +4,7 @@ version: 2.0.1
homepage: A new Flutter umeng.
environment:
sdk: ">=2.8.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.22.0"
dependencies:
......
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:umeng_crash/umeng_crash.dart';
void main() {
const MethodChannel channel = MethodChannel('umeng_crash');
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
return '42';
});
});
tearDown(() {
channel.setMockMethodCallHandler(null);
});
test('getPlatformVersion', () async {
expect(await UmengCrash.platformVersion, '42');
});
}
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