fireship-io / fireship.io

Build and ship your app faster https://fireship.io
3.57k stars 1.31k forks source link

snippets/using-js-with-flutter-web/ #755

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

How to use JS with Flutter Web

How to interop between JavaScript and Dart with Flutter Web

https://fireship.io/snippets/using-js-with-flutter-web/

pradeep14598 commented 2 years ago

Hi , i cannot able to get Output from ur code it shows error

Error: NoSuchMethodError: 'alertMessage' method not found Receiver: Instance of 'Window' Arguments: ["Flutter is calling upon JavaScript!"] at Object.throw_ [as throw] (http://localhost:40909/dart_sdk.js:5067:11) at js.JsObject._fromJs.callMethod (http://localhost:40909/dart_sdk.js:62058:19) at main$ (http://localhost:40909/packages/responsive_check/main.dart.lib.js:602:16) at main (http://localhost:40909/web_entrypoint.dart.lib.js:36:29) at main.next () at http://localhost:40909/dart_sdk.js:40571:33 at _RootZone.runUnary (http://localhost:40909/dart_sdk.js:40441:59) at _FutureListener.thenAwait.handleValue (http://localhost:40909/dart_sdk.js:35363:29) at handleValueCallback (http://localhost:40909/dart_sdk.js:35931:49) at Function._propagateToListeners (http://localhost:40909/dart_sdk.js:35969:17) at _Future.new.[_completeWithValue] (http://localhost:40909/dart_sdk.js:35817:23) at http://localhost:40909/dart_sdk.js:34998:46 at _RootZone.runUnary (http://localhost:40909/dart_sdk.js:40441:59) at _FutureListener.then.handleValue (http://localhost:40909/dart_sdk.js:35363:29) at handleValueCallback (http://localhost:40909/dart_sdk.js:35931:49) at Function._propagateToListeners (http://localhost:40909/dart_sdk.js:35969:17) at _Future.new.[_completeWithValue] (http://localhost:40909/dart_sdk.js:35817:23) at async._AsyncCallbackEntry.new.callback (http://localhost:40909/dart_sdk.js:35838:35) at Object._microtaskLoop (http://localhost:40909/dart_sdk.js:40708:13) at _startMicrotaskLoop (http://localhost:40909/dart_sdk.js:40714:13) at http://localhost:40909/dart_sdk.js:36191:9

suryanadiminti99 commented 2 years ago

Hi Everyone, Hope you are doing good. I have one requirement. Hi , Is it possible to load and display Three.js content in Flutter Web Application. Also I want interactions with JS to Flutter and Flutter to JS. There is multiple plugins are there to load web URL in Flutter Mobile App. I don't need for mobile.

RusiraLiyanage commented 2 years ago

Heyy I am really impressed with your method but while compiling the flutter application, I am getting the following error.

: Error: Not found: 'dart:js'

ChiranjibGanguly commented 2 years ago

want to call app.js functions from web console and it will reflect in some flutter view. --- any suggestion how can we achieve this