Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformException(recreating_view, trying to create an already created view, view id: '0', null) #2504

Open
1 task
grove86dipesh opened this issue Jan 16, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@grove86dipesh
Copy link

grove86dipesh commented Jan 16, 2025

Current Behavior

I have issue facing on hot restart, while I click on hot restart same page without any click or page change.
I have used "flutter_inappwebview: ^6.1.5". First time launch the app everything is work fine but, when i click on hot restart that time this error facing.

Image

Steps with code example to reproduce

Steps with code example to reproduce
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

class WebViewWidget extends StatefulWidget {
  const WebViewWidget({super.key});

  @override
  State<WebViewWidget> createState() => _WebViewWidgetState();
}

class _WebViewWidgetState extends State<WebViewWidget> {
  final GlobalKey webViewKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      child: InAppWebView(
        key: webViewKey,
        onWebViewCreated: (controller) {
          controller.loadUrl(
              urlRequest: URLRequest(
                  url: WebUri(
                      "https://inappwebview.dev/docs/webview/in-app-webview")));
        },
      ),
    );
  }

  @override
  void dispose() {
    debugPrint("WebViewPage dispose called.");
    super.dispose();
  }
}

Stacktrace/Logs

Stacktrace/Logs
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(recreating_view, trying to create an already created view, view id: '0', null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:646:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
<asynchronous suspension>
#2      PlatformViewsService.initUiKitView (package:flutter/src/services/platform_views.dart:248:5)
<asynchronous suspension>
#3      _DarwinViewState._createNewUiKitView (package:flutter/src/widgets/platform_view.dart:921:36)
<asynchronous suspension>

Flutter version

v3.27.2

Operating System, Device-specific and/or Tool

Flutter doctor

/Users/dipeshjethwa/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 3.27.2, on macOS 15.2 24C101 darwin-arm64, locale en-IN)
• Flutter version 3.27.2 on channel stable at /Users/dipeshjethwa/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 68415ad1d9 (3 days ago), 2025-01-13 10:22:03 -0800
• Engine revision e672b006cb
• Dart version 3.6.1
• DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/dipeshjethwa/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = /Users/dipeshjethwa/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] Connected device (5 available)
• iPhone XR (mobile) • 00008020-0006111C2EBB002E • ios • iOS 18.1.1 22B91
• iPhone 16 Pro Max (mobile) • B54FE8C6-4409-4786-A839-B741E66304A6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.2 24C101 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.2 24C101 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.206

[✓] Network resources
• All expected network resources are available.

• No issues found!
Process finished with exit code 0

Plugin version

v6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!
@grove86dipesh grove86dipesh added the bug Something isn't working label Jan 16, 2025
@Klim-Karma
Copy link

The same thing happens to me on flutter_inappwebview: ^6.0.0 and Flutter v3.27.1, Xcode 15.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants