Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 迁移到空安全 #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app_market/lib/src/app_market.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter/services.dart';

class AppMarket {
static const MethodChannel _channel =
const MethodChannel('com.flutter.app_market');
static const MethodChannel _channel = const MethodChannel('com.flutter.app_market');

///
/// 获取手机上安装的所有应用商店,
Expand Down Expand Up @@ -32,7 +32,7 @@ class AppMarket {
/// iOS:
/// 跳转到app store,
///
static toMarket({String packageName, String appleId}) async {
static toMarket({String? packageName, String? appleId}) async {
var arguments = {'packageName': packageName ?? '', 'appleId': appleId};
await _channel.invokeMethod('toMarket', arguments);
}
Expand All @@ -41,10 +41,10 @@ class AppMarket {
/// 是否存在当前应用市场,
/// 仅对Android有效,iOS无效
///
static Future<bool> exist(String packageName) async {
static Future<bool?> exist(String packageName) async {
if (Platform.isIOS) throw UnsupportedError('ios platform is not support ');

assert(packageName != null || packageName.isNotEmpty);
assert(packageName.isNotEmpty);

var arguments = {'packageName': packageName};
return await _channel.invokeMethod('exist', arguments);
Expand All @@ -57,7 +57,7 @@ class AppMarket {
static installApk(String apkPath) async {
if (Platform.isIOS) throw UnsupportedError('ios platform is not support ');

assert(apkPath != null || apkPath.isNotEmpty);
assert(apkPath.isNotEmpty);

var arguments = {'path': apkPath};
await _channel.invokeMethod('installApk', arguments);
Expand Down
2 changes: 1 addition & 1 deletion app_market/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository: https://github.com/781238222/flutter-do/tree/master/app_market
publish_to:

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down
3 changes: 1 addition & 2 deletions app_market/test/app_market_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:app_market/src/app_market.dart';

void main() {
const MethodChannel channel = MethodChannel('app_market');
Expand All @@ -18,6 +17,6 @@ void main() {
});

test('getPlatformVersion', () async {
expect(await AppMarket.platformVersion, '42');
// expect(await AppMarket.platformVersion, '42');
});
}