Skip to content

Commit 8aef4b8

Browse files
authored
Fix mounted checks (#5305)
Fixes in preparation for https://dart-review.googlesource.com/c/sdk/+/330561. The change referenced above tightens the `use_build_context_synchronously` lint to ensure that `mounted` is checked on the appropriate `BuildContext` or `State`. This change fixes up violations in the flutter/packages repo in preparation of this new enforcement.
1 parent 9ec7ee6 commit 8aef4b8

File tree

9 files changed

+18
-6
lines changed

9 files changed

+18
-6
lines changed

packages/webview_flutter/webview_flutter/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.4.2
2+
3+
* Fixes `use_build_context_synchronously` lint violations in the example app.
4+
15
## 4.4.1
26

37
* Exposes `JavaScriptLogLevel` from platform interface.

packages/webview_flutter/webview_flutter/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Page resource error:
217217
return FloatingActionButton(
218218
onPressed: () async {
219219
final String? url = await _controller.currentUrl();
220-
if (context.mounted) {
220+
if (mounted) {
221221
ScaffoldMessenger.of(context).showSnackBar(
222222
SnackBar(content: Text('Favorited $url')),
223223
);

packages/webview_flutter/webview_flutter/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: webview_flutter
22
description: A Flutter plugin that provides a WebView widget on Android and iOS.
33
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
5-
version: 4.4.1
5+
version: 4.4.2
66

77
environment:
88
sdk: ">=2.19.0 <4.0.0"

packages/webview_flutter/webview_flutter_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.12.1
2+
3+
* Fixes `use_build_context_synchronously` lint violations in the example app.
4+
15
## 3.12.0
26

37
* Adds support for `PlatformWebViewController.getUserAgent`.

packages/webview_flutter/webview_flutter_android/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Page resource error:
210210
return FloatingActionButton(
211211
onPressed: () async {
212212
final String? url = await _controller.currentUrl();
213-
if (context.mounted) {
213+
if (mounted) {
214214
ScaffoldMessenger.of(context).showSnackBar(
215215
SnackBar(content: Text('Favorited $url')),
216216
);

packages/webview_flutter/webview_flutter_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: webview_flutter_android
22
description: A Flutter plugin that provides a WebView widget on Android.
33
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
5-
version: 3.12.0
5+
version: 3.12.1
66

77
environment:
88
sdk: ">=2.19.0 <4.0.0"

packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.9.3
2+
3+
* Fixes `use_build_context_synchronously` lint violations in the example app.
4+
15
## 3.9.2
26

37
* Fixes error caused by calling `WKWebViewConfiguration.limitsNavigationsToAppBoundDomains` on

packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Page resource error:
211211
return FloatingActionButton(
212212
onPressed: () async {
213213
final String? url = await _controller.currentUrl();
214-
if (context.mounted) {
214+
if (mounted) {
215215
ScaffoldMessenger.of(context).showSnackBar(
216216
SnackBar(content: Text('Favorited $url')),
217217
);

packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: webview_flutter_wkwebview
22
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
33
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
5-
version: 3.9.2
5+
version: 3.9.3
66

77
environment:
88
sdk: ">=2.19.0 <4.0.0"

0 commit comments

Comments
 (0)