Skip to content

Commit 684d840

Browse files
mehmetfamantoux
authored andcommitted
[share] Migrate to null-safety (flutter#3311)
1 parent 2ead6c7 commit 684d840

File tree

5 files changed

+19
-33
lines changed

5 files changed

+19
-33
lines changed

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(['']),

script/nnbd_plugins.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ readonly NNBD_PLUGINS_LIST=(
1313
"local_auth"
1414
"path_provider"
1515
"plugin_platform_interface"
16+
"share"
1617
"url_launcher"
1718
"video_player"
1819
"webview_flutter"

0 commit comments

Comments
 (0)