From 4cd1900eff3fd96932f9596e69125715804a8227 Mon Sep 17 00:00:00 2001 From: Maurice Raguse Date: Thu, 1 Apr 2021 12:05:04 +0200 Subject: [PATCH] migrate to nullSafety --- example/pubspec.lock | 101 +++++++++++++++++++----------------- lib/system_proxy.dart | 2 +- pubspec.yaml | 2 +- test/system_proxy_test.dart | 10 ++-- 4 files changed, 60 insertions(+), 55 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 2e5e4e4..c8455e2 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,37 +5,58 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -50,37 +71,23 @@ packages: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.10" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.7.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.3" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -90,30 +97,30 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" system_proxy: dependency: "direct dev" description: @@ -125,29 +132,29 @@ packages: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.12.0 <3.0.0" diff --git a/lib/system_proxy.dart b/lib/system_proxy.dart index 296126e..0cd0dcc 100644 --- a/lib/system_proxy.dart +++ b/lib/system_proxy.dart @@ -11,7 +11,7 @@ class SystemProxy { /// Has proxy, return: {port: 8899, host: 172.24.141.93} /// no proxy, return: null /// - static Future> getProxySettings() async { + static Future?> getProxySettings() async { if (Platform.isAndroid) { dynamic proxySettingRes = await _channel.invokeMethod('getProxySettings'); diff --git a/pubspec.yaml b/pubspec.yaml index ee13a50..ed96325 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ author: kaivean homepage: https://github.com/kaivean/system_proxy environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: diff --git a/test/system_proxy_test.dart b/test/system_proxy_test.dart index b19d1ac..5c20a29 100644 --- a/test/system_proxy_test.dart +++ b/test/system_proxy_test.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:system_proxy/system_proxy.dart'; @@ -7,10 +9,7 @@ void main() { setUp(() { channel.setMockMethodCallHandler((MethodCall methodCall) async { - return { - 'host': '127.0.0.1', - 'port': '8899' - }; + return {'host': '127.0.0.1', 'port': '8899'}; }); }); @@ -19,8 +18,7 @@ void main() { }); test('getProxySettings', () async { - - Map proxy = await SystemProxy.getProxySettings(); + Map proxy = await (SystemProxy.getProxySettings() as FutureOr>); expect(proxy['host'], '127.0.0.1'); expect(proxy['port'], '8899');