Skip to content

Commit 33c85f1

Browse files
Updated deprecated widgets with new one
1 parent 7e1d571 commit 33c85f1

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

platform_channels/lib/src/method_channel_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class _MethodChannelDemoState extends State<MethodChannelDemo> {
8484
}
8585

8686
void showErrorMessage(BuildContext context, String errorMessage) {
87-
Scaffold.of(context).showSnackBar(SnackBar(
87+
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
8888
content: Text(errorMessage),
8989
));
9090
}

platform_channels/lib/src/pet_list_screen.dart

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

1616
class _PetListScreenState extends State<PetListScreen> {
1717
PetListModel petListModel;
18-
final scaffoldKey = GlobalKey<ScaffoldState>();
18+
final scaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>();
1919

2020
@override
2121
void initState() {
@@ -25,7 +25,7 @@ class _PetListScreenState extends State<PetListScreen> {
2525
BasicMessageChannel('stringCodecDemo', StringCodec())
2626
.setMessageHandler((message) async {
2727
if (message == null) {
28-
scaffoldKey.currentState.showSnackBar(
28+
scaffoldMessengerKey.currentState.showSnackBar(
2929
SnackBar(
3030
content:
3131
const Text('An error occurred while adding pet details.')),
@@ -42,7 +42,7 @@ class _PetListScreenState extends State<PetListScreen> {
4242
@override
4343
Widget build(BuildContext context) {
4444
return Scaffold(
45-
key: scaffoldKey,
45+
key: scaffoldMessengerKey,
4646
appBar: AppBar(
4747
title: Text('Pet List'),
4848
),
@@ -93,7 +93,7 @@ class BuildPetList extends StatelessWidget {
9393
}
9494

9595
void showSnackBar(String message, BuildContext context) {
96-
Scaffold.of(context).showSnackBar(SnackBar(
96+
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
9797
content: Text(message),
9898
));
9999
}

platform_channels/pubspec.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,56 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.5.0-nullsafety.1"
10+
version: "2.5.0-nullsafety.3"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.1.0-nullsafety.1"
17+
version: "2.1.0-nullsafety.3"
1818
characters:
1919
dependency: transitive
2020
description:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.0-nullsafety.3"
24+
version: "1.1.0-nullsafety.5"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.2.0-nullsafety.1"
31+
version: "1.2.0-nullsafety.3"
3232
clock:
3333
dependency: transitive
3434
description:
3535
name: clock
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.1.0-nullsafety.1"
38+
version: "1.1.0-nullsafety.3"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.15.0-nullsafety.3"
45+
version: "1.15.0-nullsafety.5"
4646
cupertino_icons:
4747
dependency: "direct main"
4848
description:
4949
name: cupertino_icons
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "1.0.0"
52+
version: "1.0.2"
5353
fake_async:
5454
dependency: transitive
5555
description:
5656
name: fake_async
5757
url: "https://pub.dartlang.org"
5858
source: hosted
59-
version: "1.2.0-nullsafety.1"
59+
version: "1.2.0-nullsafety.3"
6060
flutter:
6161
dependency: "direct main"
6262
description: flutter
@@ -73,21 +73,21 @@ packages:
7373
name: matcher
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "0.12.10-nullsafety.1"
76+
version: "0.12.10-nullsafety.3"
7777
meta:
7878
dependency: transitive
7979
description:
8080
name: meta
8181
url: "https://pub.dartlang.org"
8282
source: hosted
83-
version: "1.3.0-nullsafety.3"
83+
version: "1.3.0-nullsafety.6"
8484
path:
8585
dependency: transitive
8686
description:
8787
name: path
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "1.8.0-nullsafety.1"
90+
version: "1.8.0-nullsafety.3"
9191
pedantic:
9292
dependency: "direct dev"
9393
description:
@@ -106,55 +106,55 @@ packages:
106106
name: source_span
107107
url: "https://pub.dartlang.org"
108108
source: hosted
109-
version: "1.8.0-nullsafety.2"
109+
version: "1.8.0-nullsafety.4"
110110
stack_trace:
111111
dependency: transitive
112112
description:
113113
name: stack_trace
114114
url: "https://pub.dartlang.org"
115115
source: hosted
116-
version: "1.10.0-nullsafety.1"
116+
version: "1.10.0-nullsafety.6"
117117
stream_channel:
118118
dependency: transitive
119119
description:
120120
name: stream_channel
121121
url: "https://pub.dartlang.org"
122122
source: hosted
123-
version: "2.1.0-nullsafety.1"
123+
version: "2.1.0-nullsafety.3"
124124
string_scanner:
125125
dependency: transitive
126126
description:
127127
name: string_scanner
128128
url: "https://pub.dartlang.org"
129129
source: hosted
130-
version: "1.1.0-nullsafety.1"
130+
version: "1.1.0-nullsafety.3"
131131
term_glyph:
132132
dependency: transitive
133133
description:
134134
name: term_glyph
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "1.2.0-nullsafety.1"
137+
version: "1.2.0-nullsafety.3"
138138
test_api:
139139
dependency: transitive
140140
description:
141141
name: test_api
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "0.2.19-nullsafety.2"
144+
version: "0.2.19-nullsafety.6"
145145
typed_data:
146146
dependency: transitive
147147
description:
148148
name: typed_data
149149
url: "https://pub.dartlang.org"
150150
source: hosted
151-
version: "1.3.0-nullsafety.3"
151+
version: "1.3.0-nullsafety.5"
152152
vector_math:
153153
dependency: transitive
154154
description:
155155
name: vector_math
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "2.1.0-nullsafety.3"
158+
version: "2.1.0-nullsafety.5"
159159
sdks:
160-
dart: ">=2.10.0-110 <2.11.0"
160+
dart: ">=2.12.0-0.0 <3.0.0"

0 commit comments

Comments
 (0)