Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 789fd5a

Browse files
committed
Added clearLocalStorage method and test
1 parent 44d7782 commit 789fd5a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

packages/webview_flutter/webview_flutter_platform_interface/lib/v4/src/webview_controller_delegate.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ abstract class WebViewControllerDelegate extends PlatformInterface {
151151
'clearCache is not implemented on the current platform');
152152
}
153153

154+
/// Clears the local storage used by the [WebView].
155+
Future<void> clearLocalStorage() {
156+
throw UnimplementedError(
157+
'clearLocalStorage is not implemented on the current platform');
158+
}
159+
154160
/// Sets the [NavigationCallbackDelegate] containing the callback methods that
155161
/// are called during navigation events.
156162
Future<void> setNavigationCallbackDelegate(

packages/webview_flutter/webview_flutter_platform_interface/test/src/v4/webview_controller_delegate_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,20 @@ void main() {
201201
);
202202
});
203203

204+
test(
205+
// ignore: lines_longer_than_80_chars
206+
'Default implementation of clearLocalStorage should throw unimplemented error',
207+
() {
208+
final WebViewControllerDelegate controller =
209+
ExtendsWebViewControllerDelegate(
210+
const WebViewControllerCreationParams());
211+
212+
expect(
213+
() => controller.clearLocalStorage(),
214+
throwsUnimplementedError,
215+
);
216+
});
217+
204218
test(
205219
'Default implementation of the setNavigationCallback should throw unimplemented error',
206220
() {

0 commit comments

Comments
 (0)