How to get callback from Angular WebApp through WebViewFlutter? and Issues with Polyfills and...

Discussão em 'Angular' iniciado por Febin Johnson, Outubro 29, 2024.

  1. I'm building a Flutter app that uses WebView to load an authentication form developed in Angular. Once the signup form is completed, I need the response from the Angular app to be returned to Flutter through a callback in webview_flutter. However, I'm encountering issues with polyfills and syntax errors when trying to run this setup. Because of this the view is not rendering in webview flutter.

    Here's what I've set up:

    • The Angular app is hosted locally on an Nginx server.
    • I'm loading the Angular signup form in a WebView using Flutter's webview_flutter package. (not Loading view due to errors)
    • On form submission, I want to capture the response in Flutter. (Expected)

    My Questions are


    • What could be causing this syntax error, and how can I resolve it in an Angular app running on an Nginx server?


    • How can I set up a callback between the Angular web app and Flutter WebView to capture the response on form submission?

    Any guidance on handling polyfills for compatibility with Flutter's WebView or advice on setting up the callback would be greatly appreciated.

    Flutter webview

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

    @override
    State<AuthScreen> createState() => _AuthScreenState();
    }

    class _AuthScreenState extends State<AuthScreen> {
    late WebViewController _webViewController;

    @override
    void initState() {
    super.initState();
    _webViewController = WebViewController()
    ..setJavaScriptMode(JavaScriptMode.unrestricted)
    ..setNavigationDelegate(NavigationDelegate(
    onPageFinished: (url) {
    debugPrint('Page finished loading: $url');
    },
    ))
    ..loadRequest(Uri.parse('url'));
    }

    @override
    Widget build(BuildContext context) {
    return Scaffold(
    body: SafeArea(child: WebViewWidget(controller: _webViewController)),
    );
    }
    }


    Errors

    I/PlatformViewsController( 7630): Hosting view in view hierarchy for platform view: 0
    I/PlatformViewsController( 7630): PlatformView is using SurfaceProducer backend
    E/FrameEvents( 7630): updateAcquireFence: Did not find frame.
    I/chromium( 7630): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token '{'", source: http://'url'/polyfills-FFHMD2TL.js (1)
    I/chromium( 7630): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token '='", source: http://'url'/main-QES4K2S4.js (1)
    E/FrameEvents( 7630): updateAcquireFence: Did not find frame.
    W/ImageReaderSurfaceProducer( 7630): ImageTextureEntry can't wait on the fence on Android < 33
    2
    E/FrameEvents( 7630): updateAcquireFence: Did not find frame.
    I/chatty ( 7630): uid=10154(com.example.pwa_flutter_3) RenderThread identical 3 lines
    2
    E/FrameEvents( 7630): updateAcquireFence: Did not find frame.
    I/chatty ( 7630): uid=10154(com.example.pwa_flutter_3) RenderThread identical 3 lines
    E/FrameEvents( 7630): updateAcquireFence: Did not find frame.

    Continue reading...

Compartilhe esta Página