Skip to content

Commit

Permalink
Fix mounted checks (#5305)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
goderbauer committed Nov 2, 2023
1 parent 9ec7ee6 commit 8aef4b8
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/webview_flutter/webview_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.4.2

* Fixes `use_build_context_synchronously` lint violations in the example app.

## 4.4.1

* Exposes `JavaScriptLogLevel` from platform interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Page resource error:
return FloatingActionButton(
onPressed: () async {
final String? url = await _controller.currentUrl();
if (context.mounted) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Favorited $url')),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/webview_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter
description: A Flutter plugin that provides a WebView widget on Android and iOS.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
version: 4.4.1
version: 4.4.2

environment:
sdk: ">=2.19.0 <4.0.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/webview_flutter/webview_flutter_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.12.1

* Fixes `use_build_context_synchronously` lint violations in the example app.

## 3.12.0

* Adds support for `PlatformWebViewController.getUserAgent`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Page resource error:
return FloatingActionButton(
onPressed: () async {
final String? url = await _controller.currentUrl();
if (context.mounted) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Favorited $url')),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_android
description: A Flutter plugin that provides a WebView widget on Android.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
version: 3.12.0
version: 3.12.1

environment:
sdk: ">=2.19.0 <4.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.9.3

* Fixes `use_build_context_synchronously` lint violations in the example app.

## 3.9.2

* Fixes error caused by calling `WKWebViewConfiguration.limitsNavigationsToAppBoundDomains` on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Page resource error:
return FloatingActionButton(
onPressed: () async {
final String? url = await _controller.currentUrl();
if (context.mounted) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Favorited $url')),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
version: 3.9.2
version: 3.9.3

environment:
sdk: ">=2.19.0 <4.0.0"
Expand Down

0 comments on commit 8aef4b8

Please sign in to comment.