Skip to content

Commit 9d8713f

Browse files
committed
1.0.0 null safety
1 parent f2f0b03 commit 9d8713f

10 files changed

+66
-76
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 1.0.0
2+
- support null safety
13
## 0.0.7
24
- fix android/ios dispose bug
35
## 0.0.6

example/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.5.0'
8+
classpath 'com.android.tools.build:gradle:4.1.2'
99
}
1010
}
1111

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
1+
#Tue Feb 23 16:18:57 CST 2021
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

example/lib/main.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,30 @@ class _MyAppState extends State<MyApp> {
5252
Text('Running on: $_platformVersion\n'),
5353
Wrap(
5454
children: [
55-
RaisedButton(
55+
ElevatedButton(
5656
child: Text("toggleTorchMode"),
5757
onPressed: () {
5858
controller.toggleTorchMode();
5959
},
6060
),
61-
RaisedButton(
61+
ElevatedButton(
6262
child: Text("pause"),
6363
onPressed: () {
6464
controller.pause();
6565
},
6666
),
67-
RaisedButton(
67+
ElevatedButton(
6868
child: Text("resume"),
6969
onPressed: () {
7070
controller.resume();
7171
},
7272
),
73-
RaisedButton(
73+
ElevatedButton(
7474
child: Text("parse from image"),
7575
onPressed: () async {
76-
List<Media> res = await ImagesPicker.pick();
76+
List<Media>? res = await ImagesPicker.pick();
7777
if (res != null) {
78-
String qrcode = await Scan.parse(res[0].path);
78+
String qrcode = await Scan.parse(res[0].path!);
7979
print(qrcode);
8080
}
8181
},

example/pubspec.lock

+22-29
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,49 @@ packages:
77
name: async
88
url: "https://pub.flutter-io.cn"
99
source: hosted
10-
version: "2.5.0-nullsafety.1"
10+
version: "2.5.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.flutter-io.cn"
1616
source: hosted
17-
version: "2.1.0-nullsafety.1"
17+
version: "2.1.0"
1818
characters:
1919
dependency: transitive
2020
description:
2121
name: characters
2222
url: "https://pub.flutter-io.cn"
2323
source: hosted
24-
version: "1.1.0-nullsafety.3"
24+
version: "1.1.0"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.flutter-io.cn"
3030
source: hosted
31-
version: "1.2.0-nullsafety.1"
31+
version: "1.2.0"
3232
clock:
3333
dependency: transitive
3434
description:
3535
name: clock
3636
url: "https://pub.flutter-io.cn"
3737
source: hosted
38-
version: "1.1.0-nullsafety.1"
38+
version: "1.1.0"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.flutter-io.cn"
4444
source: hosted
45-
version: "1.15.0-nullsafety.3"
46-
cupertino_icons:
47-
dependency: "direct main"
48-
description:
49-
name: cupertino_icons
50-
url: "https://pub.flutter-io.cn"
51-
source: hosted
52-
version: "1.0.0"
45+
version: "1.15.0"
5346
fake_async:
5447
dependency: transitive
5548
description:
5649
name: fake_async
5750
url: "https://pub.flutter-io.cn"
5851
source: hosted
59-
version: "1.2.0-nullsafety.1"
52+
version: "1.2.0"
6053
flutter:
6154
dependency: "direct main"
6255
description: flutter
@@ -73,35 +66,35 @@ packages:
7366
name: images_picker
7467
url: "https://pub.flutter-io.cn"
7568
source: hosted
76-
version: "0.0.3"
69+
version: "1.0.0"
7770
matcher:
7871
dependency: transitive
7972
description:
8073
name: matcher
8174
url: "https://pub.flutter-io.cn"
8275
source: hosted
83-
version: "0.12.10-nullsafety.1"
76+
version: "0.12.10"
8477
meta:
8578
dependency: transitive
8679
description:
8780
name: meta
8881
url: "https://pub.flutter-io.cn"
8982
source: hosted
90-
version: "1.3.0-nullsafety.3"
83+
version: "1.3.0"
9184
path:
9285
dependency: transitive
9386
description:
9487
name: path
9588
url: "https://pub.flutter-io.cn"
9689
source: hosted
97-
version: "1.8.0-nullsafety.1"
90+
version: "1.8.0"
9891
scan:
9992
dependency: "direct main"
10093
description:
10194
path: ".."
10295
relative: true
10396
source: path
104-
version: "0.0.3"
97+
version: "1.0.0"
10598
sky_engine:
10699
dependency: transitive
107100
description: flutter
@@ -113,56 +106,56 @@ packages:
113106
name: source_span
114107
url: "https://pub.flutter-io.cn"
115108
source: hosted
116-
version: "1.8.0-nullsafety.2"
109+
version: "1.8.0"
117110
stack_trace:
118111
dependency: transitive
119112
description:
120113
name: stack_trace
121114
url: "https://pub.flutter-io.cn"
122115
source: hosted
123-
version: "1.10.0-nullsafety.1"
116+
version: "1.10.0"
124117
stream_channel:
125118
dependency: transitive
126119
description:
127120
name: stream_channel
128121
url: "https://pub.flutter-io.cn"
129122
source: hosted
130-
version: "2.1.0-nullsafety.1"
123+
version: "2.1.0"
131124
string_scanner:
132125
dependency: transitive
133126
description:
134127
name: string_scanner
135128
url: "https://pub.flutter-io.cn"
136129
source: hosted
137-
version: "1.1.0-nullsafety.1"
130+
version: "1.1.0"
138131
term_glyph:
139132
dependency: transitive
140133
description:
141134
name: term_glyph
142135
url: "https://pub.flutter-io.cn"
143136
source: hosted
144-
version: "1.2.0-nullsafety.1"
137+
version: "1.2.0"
145138
test_api:
146139
dependency: transitive
147140
description:
148141
name: test_api
149142
url: "https://pub.flutter-io.cn"
150143
source: hosted
151-
version: "0.2.19-nullsafety.2"
144+
version: "0.2.19"
152145
typed_data:
153146
dependency: transitive
154147
description:
155148
name: typed_data
156149
url: "https://pub.flutter-io.cn"
157150
source: hosted
158-
version: "1.3.0-nullsafety.3"
151+
version: "1.3.0"
159152
vector_math:
160153
dependency: transitive
161154
description:
162155
name: vector_math
163156
url: "https://pub.flutter-io.cn"
164157
source: hosted
165-
version: "2.1.0-nullsafety.3"
158+
version: "2.1.0"
166159
sdks:
167-
dart: ">=2.10.0-110 <2.11.0"
168-
flutter: ">=1.20.0 <2.0.0"
160+
dart: ">=2.12.0 <3.0.0"
161+
flutter: ">=1.12.13+hotfix.5"

example/pubspec.yaml

+3-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ description: Demonstrates how to use the scan plugin.
66
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
77

88
environment:
9-
sdk: ">=2.7.0 <3.0.0"
9+
sdk: ">=2.12.0 <3.0.0"
10+
flutter: ">=1.12.13+hotfix.5"
1011

1112
dependencies:
1213
flutter:
@@ -20,11 +21,7 @@ dependencies:
2021
# the parent directory to use the current plugin's version.
2122
path: ../
2223

23-
images_picker: ^0.0.3
24-
25-
# The following adds the Cupertino Icons font to your application.
26-
# Use with the CupertinoIcons class for iOS style icons.
27-
cupertino_icons: ^1.0.0
24+
images_picker: ^1.0.0
2825

2926
dev_dependencies:
3027
flutter_test:

example/test/widget_test.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ void main() {
1818
// Verify that platform version is retrieved.
1919
expect(
2020
find.byWidgetPredicate(
21-
(Widget widget) => widget is Text &&
22-
widget.data.startsWith('Running on:'),
21+
(Widget widget) => widget is Text && widget.data!.startsWith('Running on:'),
2322
),
2423
findsOneWidget,
2524
);

lib/scan.dart

+6-7
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class ScanView extends StatefulWidget {
2626
}) : assert(scanAreaScale <= 1.0, 'scanAreaScale must <= 1.0'),
2727
assert(scanAreaScale > 0.0, 'scanAreaScale must > 0.0');
2828

29-
final ScanController controller;
30-
final CaptureCallback onCapture;
29+
final ScanController? controller;
30+
final CaptureCallback? onCapture;
3131
final Color scanLineColor;
3232
final double scanAreaScale;
3333

@@ -36,7 +36,7 @@ class ScanView extends StatefulWidget {
3636
}
3737

3838
class _ScanViewState extends State<ScanView> {
39-
MethodChannel _channel;
39+
MethodChannel? _channel;
4040

4141
@override
4242
Widget build(BuildContext context) {
@@ -75,10 +75,9 @@ class _ScanViewState extends State<ScanView> {
7575

7676
void _onPlatformViewCreated(int id) {
7777
_channel = MethodChannel('chavesgu/scan/method_$id');
78-
_channel.setMethodCallHandler((MethodCall call) async {
78+
_channel?.setMethodCallHandler((MethodCall call) async {
7979
if (call.method == 'onCaptured') {
80-
if (widget.onCapture != null)
81-
widget.onCapture(call.arguments.toString());
80+
if (widget.onCapture != null) widget.onCapture!(call.arguments.toString());
8281
}
8382
});
8483
widget.controller?._channel = _channel;
@@ -95,7 +94,7 @@ class ScanArea {
9594
}
9695

9796
class ScanController {
98-
MethodChannel _channel;
97+
MethodChannel? _channel;
9998

10099
ScanController();
101100

0 commit comments

Comments
 (0)