Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit b7072f7

Browse files
committed
Migrate to null safety
BREAKING CHANGE: this will introduce null safety and thus updates the signature of several methods.
1 parent e5e0c3b commit b7072f7

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.0-nullsafety
2+
3+
* Migrate to null safety.
4+
15
## 1.0.8
26

37
* Added webOnlyWindowName parameter

packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const MethodChannel _channel = MethodChannel('plugins.flutter.io/url_launcher');
1414
/// An implementation of [UrlLauncherPlatform] that uses method channels.
1515
class MethodChannelUrlLauncher extends UrlLauncherPlatform {
1616
@override
17-
Future<bool> canLaunch(String url) {
17+
Future<bool?> canLaunch(String url) {
1818
return _channel.invokeMethod<bool>(
1919
'canLaunch',
2020
<String, Object>{'url': url},
@@ -27,15 +27,15 @@ class MethodChannelUrlLauncher extends UrlLauncherPlatform {
2727
}
2828

2929
@override
30-
Future<bool> launch(
30+
Future<bool?> launch(
3131
String url, {
32-
@required bool useSafariVC,
33-
@required bool useWebView,
34-
@required bool enableJavaScript,
35-
@required bool enableDomStorage,
36-
@required bool universalLinksOnly,
37-
@required Map<String, String> headers,
38-
String webOnlyWindowName,
32+
required bool useSafariVC,
33+
required bool useWebView,
34+
required bool enableJavaScript,
35+
required bool enableDomStorage,
36+
required bool universalLinksOnly,
37+
required Map<String, String> headers,
38+
String? webOnlyWindowName,
3939
}) {
4040
return _channel.invokeMethod<bool>(
4141
'launch',

packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,23 @@ abstract class UrlLauncherPlatform extends PlatformInterface {
3939
}
4040

4141
/// Returns `true` if this platform is able to launch [url].
42-
Future<bool> canLaunch(String url) {
42+
Future<bool?> canLaunch(String url) {
4343
throw UnimplementedError('canLaunch() has not been implemented.');
4444
}
4545

4646
/// Returns `true` if the given [url] was successfully launched.
4747
///
4848
/// For documentation on the other arguments, see the `launch` documentation
4949
/// in `package:url_launcher/url_launcher.dart`.
50-
Future<bool> launch(
50+
Future<bool?> launch(
5151
String url, {
52-
@required bool useSafariVC,
53-
@required bool useWebView,
54-
@required bool enableJavaScript,
55-
@required bool enableDomStorage,
56-
@required bool universalLinksOnly,
57-
@required Map<String, String> headers,
58-
String webOnlyWindowName,
52+
required bool useSafariVC,
53+
required bool useWebView,
54+
required bool enableJavaScript,
55+
required bool enableDomStorage,
56+
required bool universalLinksOnly,
57+
required Map<String, String> headers,
58+
String? webOnlyWindowName,
5959
}) {
6060
throw UnimplementedError('launch() has not been implemented.');
6161
}

packages/url_launcher/url_launcher_platform_interface/pubspec.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@ description: A common platform interface for the url_launcher plugin.
33
homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 1.0.8
6+
version: 2.0.0-nullsafety
77

88
dependencies:
99
flutter:
1010
sdk: flutter
11-
meta: ^1.0.5
12-
plugin_platform_interface: ^1.0.1
11+
# TODO (mvanbeusekom): use pub.dev once 1.10.0-nullsafety released.
12+
plugin_platform_interface:
13+
git:
14+
url: https://github.com/flutter/plugins.git
15+
ref: nnbd
16+
path: packages/plugin_platform_interface
1317

1418
dev_dependencies:
1519
flutter_test:
1620
sdk: flutter
1721
mockito: ^4.1.1
18-
pedantic: ^1.8.0
22+
pedantic: ^1.10.0-nullsafety.1
1923

2024
environment:
21-
sdk: ">=2.1.0 <3.0.0"
25+
sdk: '>=2.10.0-56.0.dev <3.0.0'
2226
flutter: ">=1.9.1+hotfix.4 <2.0.0"

packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// TODO(mvanbeusekom): Remove once Mockito is migrated to null safety.
6+
// @dart = 2.9
57
import 'package:mockito/mockito.dart';
68
import 'package:flutter/services.dart';
79
import 'package:flutter_test/flutter_test.dart';

0 commit comments

Comments
 (0)