Skip to content

Commit e35a717

Browse files
committed
Merge branch 'master' into add_zoom_to_android_webview
* master: [android_intent] Migrate to nnbd (flutter#3328) [share] Migrate to null-safety (flutter#3311) [webview_flutter] Migrate to nnbd (flutter#3327) # Conflicts: # packages/webview_flutter/CHANGELOG.md # packages/webview_flutter/lib/platform_interface.dart # packages/webview_flutter/lib/webview_flutter.dart # packages/webview_flutter/pubspec.yaml # packages/webview_flutter/test/webview_flutter_test.dart
2 parents b079f08 + f8a53a5 commit e35a717

17 files changed

+400
-398
lines changed

packages/android_intent/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
## 0.3.7+8
26

37
* Update Flutter SDK constraint.

packages/android_intent/lib/android_intent.dart

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class AndroidIntent {
3636
this.arguments,
3737
this.package,
3838
this.componentName,
39-
Platform platform,
39+
Platform? platform,
4040
this.type,
4141
}) : assert(action != null || componentName != null,
4242
'action or component (or both) must be specified'),
@@ -47,8 +47,8 @@ class AndroidIntent {
4747
/// app code, it may break without warning.
4848
@visibleForTesting
4949
AndroidIntent.private({
50-
@required Platform platform,
51-
@required MethodChannel channel,
50+
required Platform platform,
51+
required MethodChannel channel,
5252
this.action,
5353
this.flags,
5454
this.category,
@@ -66,47 +66,47 @@ class AndroidIntent {
6666
/// includes constants like `ACTION_VIEW`.
6767
///
6868
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
69-
final String action;
69+
final String? action;
7070

7171
/// Constants that can be set on an intent to tweak how it is finally handled.
7272
/// Some of the constants are mirrored to Dart via [Flag].
7373
///
7474
/// See https://developer.android.com/reference/android/content/Intent.html#setFlags(int).
75-
final List<int> flags;
75+
final List<int>? flags;
7676

7777
/// An optional additional constant qualifying the given [action].
7878
///
7979
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
80-
final String category;
80+
final String? category;
8181

8282
/// The Uri that the [action] is pointed towards.
8383
///
8484
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
85-
final String data;
85+
final String? data;
8686

8787
/// The equivalent of `extras`, a generic `Bundle` of data that the Intent can
8888
/// carry. This is a slot for extraneous data that the listener may use.
8989
///
9090
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
91-
final Map<String, dynamic> arguments;
91+
final Map<String, dynamic>? arguments;
9292

9393
/// Sets the [data] to only resolve within this given package.
9494
///
9595
/// See https://developer.android.com/reference/android/content/Intent.html#setPackage(java.lang.String).
96-
final String package;
96+
final String? package;
9797

9898
/// Set the exact `ComponentName` that should handle the intent. If this is
9999
/// set [package] should also be non-null.
100100
///
101101
/// See https://developer.android.com/reference/android/content/Intent.html#setComponent(android.content.ComponentName).
102-
final String componentName;
102+
final String? componentName;
103103
final MethodChannel _channel;
104104
final Platform _platform;
105105

106106
/// Set an explicit MIME data type.
107107
///
108108
/// See https://developer.android.com/reference/android/content/Intent.html#intent-structure.
109-
final String type;
109+
final String? type;
110110

111111
bool _isPowerOfTwo(int x) {
112112
/* First x in the below expression is for the case when x is 0 */
@@ -146,17 +146,18 @@ class AndroidIntent {
146146
return false;
147147
}
148148

149-
return await _channel.invokeMethod<bool>(
149+
final result = await _channel.invokeMethod<bool>(
150150
'canResolveActivity',
151151
_buildArguments(),
152152
);
153+
return result!;
153154
}
154155

155156
/// Constructs the map of arguments which is passed to the plugin.
156157
Map<String, dynamic> _buildArguments() {
157158
return {
158159
if (action != null) 'action': action,
159-
if (flags != null) 'flags': convertFlags(flags),
160+
if (flags != null) 'flags': convertFlags(flags!),
160161
if (category != null) 'category': category,
161162
if (data != null) 'data': data,
162163
if (arguments != null) 'arguments': arguments,

packages/android_intent/pubspec.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: android_intent
22
description: Flutter plugin for launching Android Intents. Not supported on iOS.
33
homepage: https://github.com/flutter/plugins/tree/master/packages/android_intent
4-
# 0.3.y+z is compatible with 1.0.0, if you land a breaking change bump
5-
# the version to 2.0.0.
6-
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
7-
version: 0.3.7+8
4+
version: 2.0.0-nullsafety
85

96
flutter:
107
plugin:
@@ -16,15 +13,15 @@ flutter:
1613
dependencies:
1714
flutter:
1815
sdk: flutter
19-
platform: ">=2.0.0 <4.0.0"
20-
meta: ^1.0.5
16+
platform: ^3.0.0-nullsafety.4
17+
meta: ^1.3.0-nullsafety.6
2118
dev_dependencies:
22-
test: ^1.3.0
23-
mockito: ^3.0.0
19+
test: ^1.16.0-nullsafety.13
20+
mockito: ^4.1.3
2421
flutter_test:
2522
sdk: flutter
26-
pedantic: ^1.8.0
23+
pedantic: ^1.10.0-nullsafety.1
2724

2825
environment:
29-
sdk: ">=2.3.0 <3.0.0"
26+
sdk: ">=2.12.0-0 <3.0.0"
3027
flutter: ">=1.12.13+hotfix.5"

packages/android_intent/test/android_intent_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import 'package:platform/platform.dart';
1111

1212
void main() {
1313
AndroidIntent androidIntent;
14-
MockMethodChannel mockChannel;
14+
late MockMethodChannel mockChannel;
1515
setUp(() {
1616
mockChannel = MockMethodChannel();
17+
when(mockChannel.invokeMethod<bool>('canResolveActivity', any))
18+
.thenAnswer((realInvocation) async => true);
1719
});
1820

1921
group('AndroidIntent', () {

packages/share/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
## 0.6.5+5
26

37
* Update Flutter SDK constraint.

packages/share/lib/share.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class Share {
3333
/// from [MethodChannel].
3434
static Future<void> share(
3535
String text, {
36-
String subject,
37-
Rect sharePositionOrigin,
36+
String? subject,
37+
Rect? sharePositionOrigin,
3838
}) {
3939
assert(text != null);
4040
assert(text.isNotEmpty);
@@ -67,10 +67,10 @@ class Share {
6767
/// from [MethodChannel].
6868
static Future<void> shareFiles(
6969
List<String> paths, {
70-
List<String> mimeTypes,
71-
String subject,
72-
String text,
73-
Rect sharePositionOrigin,
70+
List<String>? mimeTypes,
71+
String? subject,
72+
String? text,
73+
Rect? sharePositionOrigin,
7474
}) {
7575
assert(paths != null);
7676
assert(paths.isNotEmpty);

packages/share/pubspec.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ name: share
22
description: Flutter plugin for sharing content via the platform share UI, using
33
the ACTION_SEND intent on Android and UIActivityViewController on iOS.
44
homepage: https://github.com/flutter/plugins/tree/master/packages/share
5-
# 0.6.y+z is compatible with 1.0.0, if you land a breaking change bump
6-
# the version to 2.0.0.
7-
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
8-
version: 0.6.5+5
5+
version: 2.0.0-nullsafety
96

107
flutter:
118
plugin:
@@ -17,20 +14,20 @@ flutter:
1714
pluginClass: FLTSharePlugin
1815

1916
dependencies:
20-
meta: ^1.0.5
21-
mime: ^0.9.7
17+
meta: ^1.3.0-nullsafety.6
18+
mime: ^1.0.0-nullsafety.0
2219
flutter:
2320
sdk: flutter
2421

2522
dev_dependencies:
26-
test: ^1.3.0
27-
mockito: ^3.0.0
23+
test: ^1.16.0-nullsafety.13
24+
mockito: ^4.1.3
2825
flutter_test:
2926
sdk: flutter
3027
integration_test:
3128
path: ../integration_test
32-
pedantic: ^1.8.0
29+
pedantic: ^1.10.0-nullsafety.3
3330

3431
environment:
35-
sdk: ">=2.1.0 <3.0.0"
3632
flutter: ">=1.12.13+hotfix.5"
33+
sdk: ">=2.12.0-0 <3.0.0"

packages/share/test/share_test.dart

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'package:flutter/services.dart';
1515
void main() {
1616
TestWidgetsFlutterBinding.ensureInitialized();
1717

18-
MockMethodChannel mockChannel;
18+
late MockMethodChannel mockChannel;
1919

2020
setUp(() {
2121
mockChannel = MockMethodChannel();
@@ -26,14 +26,6 @@ void main() {
2626
});
2727
});
2828

29-
test('sharing null fails', () {
30-
expect(
31-
() => Share.share(null),
32-
throwsA(const TypeMatcher<AssertionError>()),
33-
);
34-
verifyZeroInteractions(mockChannel);
35-
});
36-
3729
test('sharing empty fails', () {
3830
expect(
3931
() => Share.share(''),
@@ -58,14 +50,6 @@ void main() {
5850
}));
5951
});
6052

61-
test('sharing null file fails', () {
62-
expect(
63-
() => Share.shareFiles([null]),
64-
throwsA(const TypeMatcher<AssertionError>()),
65-
);
66-
verifyZeroInteractions(mockChannel);
67-
});
68-
6953
test('sharing empty file fails', () {
7054
expect(
7155
() => Share.shareFiles(['']),

packages/webview_flutter/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## 1.0.9
1+
## 2.0.0-nullsafety
22

3-
* Enable native double-tap to zoom, and pinch to zoom functionality on Android and default to setLoadWithOverviewMode
3+
* Migration to null-safety.
44

55
## 1.0.8
66

0 commit comments

Comments
 (0)