Skip to content

Commit 0702252

Browse files
authored
Null Safety Support (NGhebreial#37)
1 parent c2930ab commit 0702252

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

example/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MyApp extends StatefulWidget {
1515

1616
/// The class with the scaffold
1717
class _MyAppState extends State<MyApp> {
18-
File _image;
18+
File? _image;
1919
final picker = ImagePicker();
2020

2121
Future getImage() async {
@@ -61,7 +61,7 @@ class _MyAppState extends State<MyApp> {
6161
body: new Center(
6262
child: _image == null
6363
? new Text('No image selected.')
64-
: new Image.file(_image),
64+
: new Image.file(_image!),
6565
),
6666
persistentFooterButtons: <Widget>[
6767
new FloatingActionButton(

example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Demonstrates how to use the flutter_exif_rotation plugin.
33
publish_to: 'none'
44

55
environment:
6-
sdk: ">=2.0.0-dev.68.0 <3.0.0"
6+
sdk: '>=2.12.0 <3.0.0'
77
flutter: ">=1.13.0 <2.0.0"
88

99
dependencies:
@@ -18,7 +18,7 @@ dev_dependencies:
1818
flutter_test:
1919
sdk: flutter
2020

21-
image_picker: ^0.6.7+12
21+
image_picker: ^0.7.2
2222
flutter_exif_rotation:
2323
path: ../
2424

example/test/widget_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void main() {
1818
expect(
1919
find.byWidgetPredicate(
2020
(Widget widget) =>
21-
widget is Text && widget.data.startsWith('Running on:'),
21+
widget is Text && widget.data!.startsWith('Running on:'),
2222
),
2323
findsOneWidget,
2424
);

lib/flutter_exif_rotation.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@ class FlutterExifRotation {
99
static const MethodChannel _channel =
1010
const MethodChannel('flutter_exif_rotation');
1111

12-
static Future<String> get platformVersion async {
13-
final String version = await _channel.invokeMethod('getPlatformVersion');
12+
static Future<String?> get platformVersion async {
13+
final String? version = await _channel.invokeMethod('getPlatformVersion');
1414
return version;
1515
}
1616

1717
/// Get the [path] of the image and fix the orientation.
1818
/// Return the [File] with the exif data fixed
19-
static Future<File> rotateImage({@required String path}) async {
19+
static Future<File> rotateImage({required String path}) async {
2020
assert(path != null);
21-
String filePath = await _channel.invokeMethod(
21+
String filePath = await (_channel.invokeMethod(
2222
'rotateImage',
2323
<String, dynamic>{'path': path, 'save': false},
24-
);
24+
) as FutureOr<String>);
2525

2626
return new File(filePath);
2727
}
2828

2929
/// Get the [path] of the image, fix the orientation and
3030
/// saves the file in the device.
3131
/// Return the [File] with the exif data fixed
32-
static Future<File> rotateAndSaveImage({@required String path}) async {
32+
static Future<File> rotateAndSaveImage({required String path}) async {
3333
assert(path != null);
34-
String filePath = await _channel.invokeMethod(
34+
String filePath = await (_channel.invokeMethod(
3535
'rotateImage',
3636
<String, dynamic>{'path': path, 'save': true},
37-
);
37+
) as FutureOr<String>);
3838

3939
return new File(filePath);
4040
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ homepage: https://github.com/NGhebreial/flutter_exif_rotation
66
repository: https://github.com/NGhebreial/flutter_exif_rotation
77

88
environment:
9-
sdk: ">=2.1.0 <3.0.0"
9+
sdk: '>=2.12.0 <3.0.0'
1010
flutter: ">=1.13.0 <2.0.0"
1111

1212
dependencies:

0 commit comments

Comments
 (0)