Skip to content

Commit b0aa45d

Browse files
nonamedenLinusU
authored andcommitted
💥 Add null safety support (#60)
Migration guide: This version drops support for Flutter 1.x, please upgrade to Flutter 2 for continued support.
1 parent a5fc5ed commit b0aa45d

File tree

5 files changed

+71
-155
lines changed

5 files changed

+71
-155
lines changed

example/pubspec.lock

Lines changed: 33 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,62 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4-
archive:
5-
dependency: transitive
6-
description:
7-
name: archive
8-
url: "https://pub.dartlang.org"
9-
source: hosted
10-
version: "2.0.11"
11-
args:
12-
dependency: transitive
13-
description:
14-
name: args
15-
url: "https://pub.dartlang.org"
16-
source: hosted
17-
version: "1.5.2"
184
async:
195
dependency: transitive
206
description:
217
name: async
228
url: "https://pub.dartlang.org"
239
source: hosted
24-
version: "2.4.0"
10+
version: "2.5.0"
2511
boolean_selector:
2612
dependency: transitive
2713
description:
2814
name: boolean_selector
2915
url: "https://pub.dartlang.org"
3016
source: hosted
31-
version: "1.0.5"
32-
charcode:
17+
version: "2.1.0"
18+
characters:
3319
dependency: transitive
3420
description:
35-
name: charcode
21+
name: characters
3622
url: "https://pub.dartlang.org"
3723
source: hosted
38-
version: "1.1.2"
39-
collection:
24+
version: "1.1.0"
25+
charcode:
4026
dependency: transitive
4127
description:
42-
name: collection
28+
name: charcode
4329
url: "https://pub.dartlang.org"
4430
source: hosted
45-
version: "1.14.11"
46-
convert:
31+
version: "1.2.0"
32+
clock:
4733
dependency: transitive
4834
description:
49-
name: convert
35+
name: clock
5036
url: "https://pub.dartlang.org"
5137
source: hosted
52-
version: "2.1.1"
53-
crypto:
38+
version: "1.1.0"
39+
collection:
5440
dependency: transitive
5541
description:
56-
name: crypto
42+
name: collection
5743
url: "https://pub.dartlang.org"
5844
source: hosted
59-
version: "2.1.3"
45+
version: "1.15.0"
6046
cupertino_icons:
6147
dependency: "direct main"
6248
description:
6349
name: cupertino_icons
6450
url: "https://pub.dartlang.org"
6551
source: hosted
6652
version: "0.1.2"
53+
fake_async:
54+
dependency: transitive
55+
description:
56+
name: fake_async
57+
url: "https://pub.dartlang.org"
58+
source: hosted
59+
version: "1.2.0"
6760
flutter:
6861
dependency: "direct main"
6962
description: flutter
@@ -81,55 +74,27 @@ packages:
8174
relative: true
8275
source: path
8376
version: "0.2.4"
84-
image:
85-
dependency: transitive
86-
description:
87-
name: image
88-
url: "https://pub.dartlang.org"
89-
source: hosted
90-
version: "2.1.4"
9177
matcher:
9278
dependency: transitive
9379
description:
9480
name: matcher
9581
url: "https://pub.dartlang.org"
9682
source: hosted
97-
version: "0.12.6"
83+
version: "0.12.10"
9884
meta:
9985
dependency: transitive
10086
description:
10187
name: meta
10288
url: "https://pub.dartlang.org"
10389
source: hosted
104-
version: "1.1.8"
90+
version: "1.3.0"
10591
path:
10692
dependency: transitive
10793
description:
10894
name: path
10995
url: "https://pub.dartlang.org"
11096
source: hosted
111-
version: "1.6.4"
112-
pedantic:
113-
dependency: transitive
114-
description:
115-
name: pedantic
116-
url: "https://pub.dartlang.org"
117-
source: hosted
118-
version: "1.8.0+1"
119-
petitparser:
120-
dependency: transitive
121-
description:
122-
name: petitparser
123-
url: "https://pub.dartlang.org"
124-
source: hosted
125-
version: "2.4.0"
126-
quiver:
127-
dependency: transitive
128-
description:
129-
name: quiver
130-
url: "https://pub.dartlang.org"
131-
source: hosted
132-
version: "2.0.5"
97+
version: "1.8.0"
13398
sky_engine:
13499
dependency: transitive
135100
description: flutter
@@ -141,62 +106,55 @@ packages:
141106
name: source_span
142107
url: "https://pub.dartlang.org"
143108
source: hosted
144-
version: "1.5.5"
109+
version: "1.8.1"
145110
stack_trace:
146111
dependency: transitive
147112
description:
148113
name: stack_trace
149114
url: "https://pub.dartlang.org"
150115
source: hosted
151-
version: "1.9.3"
116+
version: "1.10.0"
152117
stream_channel:
153118
dependency: transitive
154119
description:
155120
name: stream_channel
156121
url: "https://pub.dartlang.org"
157122
source: hosted
158-
version: "2.0.0"
123+
version: "2.1.0"
159124
string_scanner:
160125
dependency: transitive
161126
description:
162127
name: string_scanner
163128
url: "https://pub.dartlang.org"
164129
source: hosted
165-
version: "1.0.5"
130+
version: "1.1.0"
166131
term_glyph:
167132
dependency: transitive
168133
description:
169134
name: term_glyph
170135
url: "https://pub.dartlang.org"
171136
source: hosted
172-
version: "1.1.0"
137+
version: "1.2.0"
173138
test_api:
174139
dependency: transitive
175140
description:
176141
name: test_api
177142
url: "https://pub.dartlang.org"
178143
source: hosted
179-
version: "0.2.11"
144+
version: "0.2.19"
180145
typed_data:
181146
dependency: transitive
182147
description:
183148
name: typed_data
184149
url: "https://pub.dartlang.org"
185150
source: hosted
186-
version: "1.1.6"
151+
version: "1.3.0"
187152
vector_math:
188153
dependency: transitive
189154
description:
190155
name: vector_math
191156
url: "https://pub.dartlang.org"
192157
source: hosted
193-
version: "2.0.8"
194-
xml:
195-
dependency: transitive
196-
description:
197-
name: xml
198-
url: "https://pub.dartlang.org"
199-
source: hosted
200-
version: "3.5.0"
158+
version: "2.1.0"
201159
sdks:
202-
dart: ">=2.4.0 <3.0.0"
160+
dart: ">=2.12.0 <3.0.0"

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Demonstrates how to use the flutter_web_auth plugin.
33
publish_to: 'none'
44

55
environment:
6-
sdk: ">=2.1.0 <3.0.0"
6+
sdk: ">=2.12.0 <3.0.0"
77

88
dependencies:
99
flutter:

lib/flutter_web_auth.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'dart:async';
22

33
import 'package:flutter/cupertino.dart';
4-
import 'package:flutter/foundation.dart' show required;
54
import 'package:flutter/services.dart' show MethodChannel;
65

76
class _OnAppLifecycleResumeObserver extends WidgetsBindingObserver {
@@ -29,9 +28,9 @@ class FlutterWebAuth {
2928
/// The page pointed to by [url] will be loaded and displayed to the user. From the page, the user can authenticate herself and grant access to the app. On completion, the service will send a callback URL with an authentication token, and this URL will be result of the returned [Future].
3029
///
3130
/// [callbackUrlScheme] should be a string specifying the scheme of the url that the page will redirect to upon successful authentication.
32-
static Future<String> authenticate({@required String url, @required String callbackUrlScheme}) async {
33-
WidgetsBinding.instance.removeObserver(_resumedObserver); // safety measure so we never add this observer twice
34-
WidgetsBinding.instance.addObserver(_resumedObserver);
31+
static Future<String> authenticate({required String url, required String callbackUrlScheme}) async {
32+
WidgetsBinding.instance?.removeObserver(_resumedObserver); // safety measure so we never add this observer twice
33+
WidgetsBinding.instance?.addObserver(_resumedObserver);
3534
return await _channel.invokeMethod('authenticate', <String, dynamic>{
3635
'url': url,
3736
'callbackUrlScheme': callbackUrlScheme,
@@ -43,6 +42,6 @@ class FlutterWebAuth {
4342
/// terminate all `authenticate` calls with an error.
4443
static Future<void> _cleanUpDanglingCalls() async {
4544
await _channel.invokeMethod('cleanUpDanglingCalls');
46-
WidgetsBinding.instance.removeObserver(_resumedObserver);
45+
WidgetsBinding.instance?.removeObserver(_resumedObserver);
4746
}
4847
}

0 commit comments

Comments
 (0)