From d1fc803dbf382f1e0caf952f56b37f21a1582e6d Mon Sep 17 00:00:00 2001 From: Jochen Date: Thu, 18 Mar 2021 22:53:55 +0800 Subject: [PATCH] support null-safety (#42) * support null-safety * fix : null-aware operation warning * fix --- example/pubspec.lock | 42 ++--- lib/src/model/api/tencent_api_resp.dart | 4 +- lib/src/model/api/tencent_user_info_resp.dart | 56 +++---- .../model/api/tencent_user_info_resp.g.dart | 44 +++--- lib/src/model/sdk/tencent_login_resp.dart | 12 +- lib/src/model/sdk/tencent_login_resp.g.dart | 4 +- lib/src/model/sdk/tencent_sdk_resp.dart | 4 +- lib/src/model/sdk/tencent_share_resp.dart | 4 +- lib/src/model/sdk/tencent_share_resp.g.dart | 4 +- .../model/unionid/tencent_unionid_resp.dart | 10 +- .../model/unionid/tencent_unionid_resp.g.dart | 2 +- lib/src/tencent.dart | 107 +++++++------ pubspec.lock | 146 +++++++----------- pubspec.yaml | 20 +-- test/tencent_kit_test.dart | 4 +- 15 files changed, 214 insertions(+), 249 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index f780ecc..9c181fb 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" 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.2.0" 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" convert: dependency: transitive description: @@ -70,7 +70,7 @@ packages: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" ffi: dependency: transitive description: @@ -115,21 +115,21 @@ packages: name: json_annotation url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.1" + version: "4.0.0" matcher: dependency: transitive description: 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.3.0" okhttp_kit: dependency: "direct main" description: @@ -143,7 +143,7 @@ packages: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" path_provider: dependency: "direct main" description: @@ -218,28 +218,28 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" 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" tencent_kit: dependency: "direct main" description: @@ -253,28 +253,28 @@ packages: 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.2.19" 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" win32: dependency: transitive description: @@ -290,5 +290,5 @@ packages: source: hosted version: "0.1.2" sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" diff --git a/lib/src/model/api/tencent_api_resp.dart b/lib/src/model/api/tencent_api_resp.dart index e3ae0c3..78f593c 100644 --- a/lib/src/model/api/tencent_api_resp.dart +++ b/lib/src/model/api/tencent_api_resp.dart @@ -13,8 +13,8 @@ abstract class TencentApiResp { @JsonKey( defaultValue: RET_SUCCESS, ) - final int ret; - final String msg; + final int? ret; + final String? msg; bool get isSuccessful => ret == RET_SUCCESS; } diff --git a/lib/src/model/api/tencent_user_info_resp.dart b/lib/src/model/api/tencent_user_info_resp.dart index 9219ad2..4b2ee13 100644 --- a/lib/src/model/api/tencent_user_info_resp.dart +++ b/lib/src/model/api/tencent_user_info_resp.dart @@ -9,8 +9,8 @@ part 'tencent_user_info_resp.g.dart'; ) class TencentUserInfoResp extends TencentApiResp { const TencentUserInfoResp({ - int ret, - String msg, + int? ret, + String? msg, this.isLost, this.nickname, this.gender, @@ -36,58 +36,58 @@ class TencentUserInfoResp extends TencentApiResp { factory TencentUserInfoResp.fromJson(Map json) => _$TencentUserInfoRespFromJson(json); - final int isLost; - final String nickname; - final String gender; // 男/女 - final int genderType; // 男/女 - 1 - final String province; - final String city; - final String year; - final String constellation; - final String figureurl; + final int? isLost; + final String? nickname; + final String? gender; // 男/女 + final int? genderType; // 男/女 - 1 + final String? province; + final String? city; + final String? year; + final String? constellation; + final String? figureurl; @JsonKey( name: 'figureurl_1', ) - final String figureurl1; + final String? figureurl1; @JsonKey( name: 'figureurl_2', ) - final String figureurl2; - final String figureurlQq; // 140 * 140 + final String? figureurl2; + final String? figureurlQq; // 140 * 140 @JsonKey( name: 'figureurl_qq_1', ) - final String figureurlQq1; // 大小为40×40像素的QQ头像URL。 + final String? figureurlQq1; // 大小为40×40像素的QQ头像URL。 @JsonKey( name: 'figureurl_qq_2', ) - final String + final String? figureurlQq2; // 大小为100×100像素的QQ头像URL。需要注意,不是所有的用户都拥有QQ的100x100的头像,但40x40像素则是一定会有。 - final String figureurlType; - final String isYellowVip; - final String vip; - final String yellowVipLevel; - final String level; - final String isYellowYearVip; + final String? figureurlType; + final String? isYellowVip; + final String? vip; + final String? yellowVipLevel; + final String? level; + final String? isYellowYearVip; bool get isMale => gender == '男'; bool get isFemale => gender == '女'; - String get headImgUrl { - if (figureurlQq != null && figureurlQq.isNotEmpty) { + String? get headImgUrl { + if (figureurlQq?.isNotEmpty != true) { return figureurlQq; } - if (figureurlQq2 != null && figureurlQq2.isNotEmpty) { + if (figureurlQq2?.isNotEmpty != true) { return figureurlQq2; } - if (figureurlQq1 != null && figureurlQq1.isNotEmpty) { + if (figureurlQq1?.isNotEmpty != true) { return figureurlQq1; } - if (figureurl2 != null && figureurl2.isNotEmpty) { + if (figureurl2?.isNotEmpty != true) { return figureurl2; } - if (figureurl1 != null && figureurl1.isNotEmpty) { + if (figureurl1?.isNotEmpty != true) { return figureurl1; } return figureurl; diff --git a/lib/src/model/api/tencent_user_info_resp.g.dart b/lib/src/model/api/tencent_user_info_resp.g.dart index ce5bcc4..e54f602 100644 --- a/lib/src/model/api/tencent_user_info_resp.g.dart +++ b/lib/src/model/api/tencent_user_info_resp.g.dart @@ -8,28 +8,28 @@ part of 'tencent_user_info_resp.dart'; TencentUserInfoResp _$TencentUserInfoRespFromJson(Map json) { return TencentUserInfoResp( - ret: json['ret'] as int ?? 0, - msg: json['msg'] as String, - isLost: json['is_lost'] as int, - nickname: json['nickname'] as String, - gender: json['gender'] as String, - genderType: json['gender_type'] as int, - province: json['province'] as String, - city: json['city'] as String, - year: json['year'] as String, - constellation: json['constellation'] as String, - figureurl: json['figureurl'] as String, - figureurl1: json['figureurl_1'] as String, - figureurl2: json['figureurl_2'] as String, - figureurlQq: json['figureurl_qq'] as String, - figureurlQq1: json['figureurl_qq_1'] as String, - figureurlQq2: json['figureurl_qq_2'] as String, - figureurlType: json['figureurl_type'] as String, - isYellowVip: json['is_yellow_vip'] as String, - vip: json['vip'] as String, - yellowVipLevel: json['yellow_vip_level'] as String, - level: json['level'] as String, - isYellowYearVip: json['is_yellow_year_vip'] as String, + ret: json['ret'] as int? ?? 0, + msg: json['msg'] as String?, + isLost: json['is_lost'] as int?, + nickname: json['nickname'] as String?, + gender: json['gender'] as String?, + genderType: json['gender_type'] as int?, + province: json['province'] as String?, + city: json['city'] as String?, + year: json['year'] as String?, + constellation: json['constellation'] as String?, + figureurl: json['figureurl'] as String?, + figureurl1: json['figureurl_1'] as String?, + figureurl2: json['figureurl_2'] as String?, + figureurlQq: json['figureurl_qq'] as String?, + figureurlQq1: json['figureurl_qq_1'] as String?, + figureurlQq2: json['figureurl_qq_2'] as String?, + figureurlType: json['figureurl_type'] as String?, + isYellowVip: json['is_yellow_vip'] as String?, + vip: json['vip'] as String?, + yellowVipLevel: json['yellow_vip_level'] as String?, + level: json['level'] as String?, + isYellowYearVip: json['is_yellow_year_vip'] as String?, ); } diff --git a/lib/src/model/sdk/tencent_login_resp.dart b/lib/src/model/sdk/tencent_login_resp.dart index 2202550..0aba02f 100644 --- a/lib/src/model/sdk/tencent_login_resp.dart +++ b/lib/src/model/sdk/tencent_login_resp.dart @@ -9,12 +9,12 @@ part 'tencent_login_resp.g.dart'; ) class TencentLoginResp extends TencentSdkResp { const TencentLoginResp({ - int ret, - String msg, - this.openid, - this.accessToken, - this.expiresIn, - this.createAt, + int? ret, + String? msg, + required this.openid, + required this.accessToken, + required this.expiresIn, + required this.createAt, }) : super(ret: ret, msg: msg); factory TencentLoginResp.fromJson(Map json) => diff --git a/lib/src/model/sdk/tencent_login_resp.g.dart b/lib/src/model/sdk/tencent_login_resp.g.dart index 399b5dc..5e8517d 100644 --- a/lib/src/model/sdk/tencent_login_resp.g.dart +++ b/lib/src/model/sdk/tencent_login_resp.g.dart @@ -8,8 +8,8 @@ part of 'tencent_login_resp.dart'; TencentLoginResp _$TencentLoginRespFromJson(Map json) { return TencentLoginResp( - ret: json['ret'] as int ?? 0, - msg: json['msg'] as String, + ret: json['ret'] as int? ?? 0, + msg: json['msg'] as String?, openid: json['openid'] as String, accessToken: json['access_token'] as String, expiresIn: json['expires_in'] as int, diff --git a/lib/src/model/sdk/tencent_sdk_resp.dart b/lib/src/model/sdk/tencent_sdk_resp.dart index 9c6791e..075f933 100644 --- a/lib/src/model/sdk/tencent_sdk_resp.dart +++ b/lib/src/model/sdk/tencent_sdk_resp.dart @@ -20,8 +20,8 @@ abstract class TencentSdkResp { @JsonKey( defaultValue: RET_SUCCESS, ) - final int ret; - final String msg; + final int? ret; + final String? msg; bool get isSuccessful => ret == RET_SUCCESS; diff --git a/lib/src/model/sdk/tencent_share_resp.dart b/lib/src/model/sdk/tencent_share_resp.dart index 0265dc9..96f0615 100644 --- a/lib/src/model/sdk/tencent_share_resp.dart +++ b/lib/src/model/sdk/tencent_share_resp.dart @@ -9,8 +9,8 @@ part 'tencent_share_resp.g.dart'; ) class TencentShareResp extends TencentSdkResp { const TencentShareResp({ - int ret, - String msg, + int? ret, + String? msg, }) : super(ret: ret, msg: msg); factory TencentShareResp.fromJson(Map json) => diff --git a/lib/src/model/sdk/tencent_share_resp.g.dart b/lib/src/model/sdk/tencent_share_resp.g.dart index 56bb334..455486b 100644 --- a/lib/src/model/sdk/tencent_share_resp.g.dart +++ b/lib/src/model/sdk/tencent_share_resp.g.dart @@ -8,8 +8,8 @@ part of 'tencent_share_resp.dart'; TencentShareResp _$TencentShareRespFromJson(Map json) { return TencentShareResp( - ret: json['ret'] as int ?? 0, - msg: json['msg'] as String, + ret: json['ret'] as int? ?? 0, + msg: json['msg'] as String?, ); } diff --git a/lib/src/model/unionid/tencent_unionid_resp.dart b/lib/src/model/unionid/tencent_unionid_resp.dart index aeeaf51..f2e261d 100644 --- a/lib/src/model/unionid/tencent_unionid_resp.dart +++ b/lib/src/model/unionid/tencent_unionid_resp.dart @@ -8,11 +8,11 @@ part 'tencent_unionid_resp.g.dart'; ) class TencentUnionidResp { const TencentUnionidResp({ - this.error, - this.errorDescription, - this.clientId, - this.openid, - this.unionid, + required this.error, + required this.errorDescription, + required this.clientId, + required this.openid, + required this.unionid, }); factory TencentUnionidResp.fromJson(Map json) => diff --git a/lib/src/model/unionid/tencent_unionid_resp.g.dart b/lib/src/model/unionid/tencent_unionid_resp.g.dart index 57147d4..2c6e84f 100644 --- a/lib/src/model/unionid/tencent_unionid_resp.g.dart +++ b/lib/src/model/unionid/tencent_unionid_resp.g.dart @@ -8,7 +8,7 @@ part of 'tencent_unionid_resp.dart'; TencentUnionidResp _$TencentUnionidRespFromJson(Map json) { return TencentUnionidResp( - error: json['error'] as int ?? 0, + error: json['error'] as int? ?? 0, errorDescription: json['error_description'] as String, clientId: json['client_id'] as String, openid: json['openid'] as String, diff --git a/lib/src/tencent.dart b/lib/src/tencent.dart index 635c01b..ec8b642 100644 --- a/lib/src/tencent.dart +++ b/lib/src/tencent.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:tencent_kit/src/model/api/tencent_user_info_resp.dart'; import 'package:tencent_kit/src/model/sdk/tencent_login_resp.dart'; @@ -71,10 +70,10 @@ class Tencent { /// 向 Open_SDK 注册 Future registerApp({ - @required String appId, - String universalLink, + required String appId, + String? universalLink, }) { - assert(appId?.isNotEmpty ?? false); + assert(appId.isNotEmpty); return _channel.invokeMethod( _METHOD_REGISTERAPP, { @@ -96,20 +95,20 @@ class Tencent { } /// 检查QQ是否已安装 - Future isQQInstalled() { + Future isQQInstalled() { return _channel.invokeMethod(_METHOD_ISQQINSTALLED); } /// 检查QQ是否已安装 - Future isTIMInstalled() { + Future isTIMInstalled() { return _channel.invokeMethod(_METHOD_ISTIMINSTALLED); } /// 登录 Future login({ - @required List scope, + required List scope, }) { - assert(scope?.isNotEmpty ?? false); + assert(scope.isNotEmpty); return _channel.invokeMethod( _METHOD_LOGIN, { @@ -126,13 +125,13 @@ class Tencent { /// 用户信息 /// https://wiki.connect.qq.com/get_user_info Future getUserInfo({ - @required String appId, - @required String openid, - @required String accessToken, + required String appId, + required String openid, + required String accessToken, }) { - assert(appId?.isNotEmpty ?? false); - assert(openid?.isNotEmpty ?? false); - assert(accessToken?.isNotEmpty ?? false); + assert(appId.isNotEmpty); + assert(openid.isNotEmpty); + assert(accessToken.isNotEmpty); return HttpClient() .getUrl(Uri.parse( 'https://graph.qq.com/user/get_user_info?access_token=$accessToken&oauth_consumer_key=$appId&openid=$openid')) @@ -140,7 +139,7 @@ class Tencent { return request.close(); }).then((HttpClientResponse response) async { if (response.statusCode == HttpStatus.ok) { - ContentType contentType = response.headers.contentType; + ContentType? contentType = response.headers.contentType; Encoding encoding = Encoding.getByName(contentType?.charset) ?? utf8; String content = await encoding.decodeStream(response); return TencentUserInfoResp.fromJson( @@ -154,10 +153,10 @@ class Tencent { /// UnionID /// https://wiki.connect.qq.com/unionid%E4%BB%8B%E7%BB%8D Future getUnionId({ - @required String accessToken, + required String accessToken, String unionid = '1', }) { - assert(accessToken?.isNotEmpty ?? false); + assert(accessToken.isNotEmpty); return HttpClient() .getUrl(Uri.parse( 'https://graph.qq.com/oauth2.0/me?access_token=$accessToken&unionid=$unionid')) @@ -165,16 +164,16 @@ class Tencent { return request.close(); }).then((HttpClientResponse response) async { if (response.statusCode == HttpStatus.ok) { - ContentType contentType = response.headers.contentType; + ContentType? contentType = response.headers.contentType; Encoding encoding = Encoding.getByName(contentType?.charset) ?? utf8; String callback = await encoding.decodeStream(response); // 腾讯有毒 callback( $json ); RegExp exp = RegExp(r'callback\( (.*) \)\;'); - Match match = exp.firstMatch(callback); - if (match.groupCount == 1) { - String content = match.group(1); + Match? match = exp.firstMatch(callback); + if (match?.groupCount == 1) { + String? content = match?.group(1); return TencentUnionidResp.fromJson( - json.decode(content) as Map); + json.decode(content ?? '') as Map); } } throw HttpException( @@ -184,18 +183,18 @@ class Tencent { /// 分享 - 说说 Future shareMood({ - @required int scene, - String summary, - List imageUris, - Uri videoUri, + required int scene, + String? summary, + List? imageUris, + Uri? videoUri, }) { assert(scene == TencentScene.SCENE_QZONE); assert((summary?.isNotEmpty ?? false) || (imageUris?.isNotEmpty ?? false) || (videoUri != null && videoUri.isScheme(_SCHEME_FILE)) || ((imageUris?.isNotEmpty ?? false) && - imageUris.every((Uri element) => - element != null && element.isScheme(_SCHEME_FILE)))); + imageUris?.every((Uri element) => + element.isScheme(_SCHEME_FILE)) == true)); return _channel.invokeMethod( _METHOD_SHAREMOOD, { @@ -203,7 +202,7 @@ class Tencent { if (summary?.isNotEmpty ?? false) _ARGUMENT_KEY_SUMMARY: summary, if (imageUris?.isNotEmpty ?? false) _ARGUMENT_KEY_IMAGEURIS: - imageUris.map((Uri imageUri) => imageUri.toString()).toList(), + imageUris?.map((Uri imageUri) => imageUri.toString()).toList(), if (videoUri != null) _ARGUMENT_KEY_VIDEOURI: videoUri.toString(), }, ); @@ -211,11 +210,11 @@ class Tencent { /// 分享 - 文本(Android调用的是系统API,故而不会有回调) Future shareText({ - @required int scene, - @required String summary, + required int scene, + required String summary, }) { assert(scene == TencentScene.SCENE_QQ); - assert(summary?.isNotEmpty ?? false); + assert(summary.isNotEmpty); return _channel.invokeMethod( _METHOD_SHARETEXT, { @@ -227,13 +226,13 @@ class Tencent { /// 分享 - 图片 Future shareImage({ - @required int scene, - @required Uri imageUri, - String appName, + required int scene, + required Uri imageUri, + String? appName, int extInt = TencentQZoneFlag.DEFAULT, }) { assert(scene == TencentScene.SCENE_QQ); - assert(imageUri != null && imageUri.isScheme(_SCHEME_FILE)); + assert(imageUri.isScheme(_SCHEME_FILE)); return _channel.invokeMethod( _METHOD_SHAREIMAGE, { @@ -247,19 +246,19 @@ class Tencent { /// 分享 - 音乐 Future shareMusic({ - @required int scene, - @required String title, - String summary, - Uri imageUri, - @required String musicUrl, - @required String targetUrl, - String appName, + required int scene, + required String title, + String? summary, + Uri? imageUri, + required String musicUrl, + required String targetUrl, + String? appName, int extInt = TencentQZoneFlag.DEFAULT, }) { assert(scene == TencentScene.SCENE_QQ); - assert(title?.isNotEmpty ?? false); - assert(musicUrl?.isNotEmpty ?? false); - assert(targetUrl?.isNotEmpty ?? false); + assert(title.isNotEmpty); + assert(musicUrl.isNotEmpty); + assert(targetUrl.isNotEmpty); return _channel.invokeMethod( _METHOD_SHAREMUSIC, { @@ -277,16 +276,16 @@ class Tencent { /// 分享 - 网页 Future shareWebpage({ - @required int scene, - @required String title, - String summary, - Uri imageUri, - @required String targetUrl, - String appName, + required int scene, + required String title, + String? summary, + Uri? imageUri, + required String targetUrl, + String? appName, int extInt = TencentQZoneFlag.DEFAULT, }) { - assert(title?.isNotEmpty ?? false); - assert(targetUrl?.isNotEmpty ?? false); + assert(title.isNotEmpty); + assert(targetUrl.isNotEmpty); return _channel.invokeMethod( _METHOD_SHAREWEBPAGE, { diff --git a/pubspec.lock b/pubspec.lock index 11664c1..41331d8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.flutter-io.cn" source: hosted - version: "14.0.0" + version: "18.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.flutter-io.cn" source: hosted - version: "0.41.2" + version: "1.2.0" args: dependency: transitive description: @@ -28,56 +28,56 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" 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" build: dependency: transitive description: name: build url: "https://pub.flutter-io.cn" source: hosted - version: "1.6.1" + version: "2.0.0" build_config: dependency: transitive description: name: build_config url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.5" + version: "0.4.7" build_daemon: dependency: transitive description: name: build_daemon url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.6" + version: "2.1.10" build_resolvers: dependency: transitive description: name: build_resolvers url: "https://pub.flutter-io.cn" source: hosted - version: "1.5.2" + version: "2.0.0" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.flutter-io.cn" source: hosted - version: "1.11.0" + version: "1.12.2" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.flutter-io.cn" source: hosted - version: "6.1.6" + version: "6.1.12" built_collection: dependency: transitive description: @@ -98,35 +98,35 @@ packages: 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.2.0" checked_yaml: dependency: transitive description: name: checked_yaml url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.4" + version: "2.0.1" cli_util: dependency: transitive description: name: cli_util url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.0" + version: "0.3.0" clock: dependency: transitive description: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" code_builder: dependency: transitive description: @@ -140,49 +140,49 @@ packages: name: collection url: "https://pub.flutter-io.cn" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" convert: dependency: transitive description: name: convert url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.1" + version: "3.0.0" crypto: dependency: transitive description: name: crypto url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.5" + version: "3.0.0" dart_style: dependency: transitive description: name: dart_style url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.11" + version: "1.3.14" 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" ffi: dependency: transitive description: name: ffi url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.3" + version: "1.0.0" file: dependency: transitive description: name: file url: "https://pub.flutter-io.cn" source: hosted - version: "5.2.1" + version: "6.1.0" fixnum: dependency: transitive description: @@ -206,14 +206,14 @@ packages: name: glob url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "2.0.0" graphs: dependency: transitive description: name: graphs url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.0" + version: "1.0.0" http_multi_server: dependency: transitive description: @@ -228,13 +228,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.1.4" - intl: - dependency: transitive - description: - name: intl - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.16.1" io: dependency: transitive description: @@ -255,35 +248,35 @@ packages: name: json_annotation url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.1" + version: "4.0.0" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.flutter-io.cn" source: hosted - version: "3.5.1" + version: "4.0.3" logging: dependency: transitive description: name: logging url: "https://pub.flutter-io.cn" source: hosted - version: "0.11.4" + version: "1.0.0" matcher: dependency: transitive description: 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.3.0" mime: dependency: transitive description: @@ -291,125 +284,104 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.9.7" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.2.1" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.2.0" - okhttp_kit: - dependency: "direct dev" - description: - name: okhttp_kit - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.2" package_config: dependency: transitive description: name: package_config url: "https://pub.flutter-io.cn" source: hosted - version: "1.9.3" + version: "2.0.0" path: dependency: "direct dev" description: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" path_provider: dependency: "direct dev" description: name: path_provider url: "https://pub.flutter-io.cn" source: hosted - version: "1.6.27" + version: "2.0.1" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.4+8" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.4" + version: "2.0.1" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.4+3" + version: "2.0.0" pedantic: dependency: "direct dev" description: name: pedantic url: "https://pub.flutter-io.cn" source: hosted - version: "1.9.2" + version: "1.11.0" platform: dependency: transitive description: name: platform url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.1" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.3" + version: "2.0.0" pool: dependency: transitive description: name: pool url: "https://pub.flutter-io.cn" source: hosted - version: "1.4.0" + version: "1.5.0" process: dependency: transitive description: name: process url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.13" + version: "4.1.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.flutter-io.cn" source: hosted - version: "1.4.4" + version: "2.0.0" pubspec_parse: dependency: transitive description: name: pubspec_parse url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.7" + version: "1.0.0" quiver: dependency: transitive description: @@ -442,56 +414,56 @@ packages: name: source_gen url: "https://pub.flutter-io.cn" source: hosted - version: "0.9.10+1" + version: "0.9.10+4" source_span: dependency: transitive description: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" 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" stream_transform: dependency: transitive description: name: stream_transform url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "2.0.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.2.19" timing: dependency: transitive description: @@ -505,21 +477,21 @@ packages: 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" watcher: dependency: transitive description: name: watcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.9.7+15" + version: "1.0.0" web_socket_channel: dependency: transitive description: @@ -533,21 +505,21 @@ packages: name: win32 url: "https://pub.flutter-io.cn" source: hosted - version: "1.7.4+1" + version: "2.0.4" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.2" + version: "0.2.0" yaml: dependency: transitive description: name: yaml url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.1" + version: "3.1.0" sdks: - dart: ">=2.10.0 <2.11.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0ec118b..2e60b65 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,28 +5,22 @@ version: 2.0.1 homepage: https://github.com/v7lin/fake_tencent environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" flutter: ">=1.10.0" dependencies: flutter: sdk: flutter - - json_annotation: '>=2.0.0 <4.0.0' + json_annotation: ^4.0.0 dev_dependencies: + build_runner: ^1.12.2 flutter_test: sdk: flutter - - path: ^1.6.4 - path_provider: ^1.4.0 - - okhttp_kit: ^1.0.0 - - pedantic: - - build_runner: - json_serializable: + json_serializable: ^4.0.3 + path: ^1.8.0 + path_provider: ^2.0.1 + pedantic: ^1.11.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/test/tencent_kit_test.dart b/test/tencent_kit_test.dart index b9387ce..c6a2fee 100644 --- a/test/tencent_kit_test.dart +++ b/test/tencent_kit_test.dart @@ -26,7 +26,7 @@ void main() { channel.name, channel.codec.encodeMethodCall( MethodCall('onLoginResp', json.decode('{"ret":-2}'))), - (ByteData data) { + (ByteData? data) { // mock success }, )); @@ -42,7 +42,7 @@ void main() { channel.name, channel.codec.encodeMethodCall( MethodCall('onShareResp', json.decode('{"ret":0}'))), - (ByteData data) { + (ByteData? data) { // mock success }, ));