How can I use js packages in flutter web? - flutter

I need to use some js libraries in flutter. Lets say I want to use, for example, moment.js (https://www.npmjs.com/package/moment).
Many people talk about this package for flutter https://pub.dev/packages/js and using this allows to use js libraries. I read the documentation, and still cant understand the procedure to import the js libraries into the flutter project.
Does someone has experience with this? And can possible provide an example?
Thank you

Related

Flutter_How to scrap the data from Javascript in web?

I need to get data from javascript in web-site.
It was successful to get data from general html web by using flutter_webscrapper dart package but looks like the webscrapper do not support to load javascript and scrap it.
I've been searching it and lots of developers recommend to use flutter_webview as headless browser.
However, flutter_webview spends too much time to create browser & load website. It takes almost over 4~5 seconds. Seems that challenge to use it in commercial product.
I also cannot use flutter_puppeteer because it does not support android & ios.
If there are any other way or other Dart package to scrap the data from javascript in web-site, please let me recommend. Waiting for your supports.
You can use web_scraper package .
may be using getAllScripts or getScriptVariables methods help you .
this sample repository used web_scraper package .

Converting ShapeFile to GeoJson using Dart

I researched every possible way for me to convert files with extensions .shp, .dbf, .shx to GeoJson, or even some way to open them and use them within Dart.
I was only able to find this library:
import 'package:dart_shp/dart_shp.dart';
But it is not very well documented, or with examples of use and I am not able to use it. I sincerely ask for your help!
I tried ways to run GDAL from Java within flutter, or any language that offers integration with flutter that has some ready resource that does that.

Is there a way to pass data from javascript layer to AppDelegate.swift without a plugin in Ionic Capacitor?

I'm using Ionic Capacitor (javascript application + ios/android native wrappers), and I have a situation where I want to get a small piece of data from the javascript layer and pass to ./ios/App/AppDelegate.swift.
Is there any way to achieve this without the use of a plugin? For example, can AppDelegate.swift "listen" for javascript events in a manner similar to how a Capacitor plugin would?
Thus, in my application, I would have a form field (e.g. for email), and then on button click I pass the string to AppDelegate.swift, which then does something with it.
Yes you can do it.
It's documented here
That not the favourite way, though.
Edit:
this is from native to JS in the doc, sorry about it.
I checked a the module you want to install in your app, it seems you want to do it in AppDelegated because of the need of UIApplication.
If it's that i recommend you to create a plugin and use it inside like here
Or last solution you can use a config if you don't need to change the config by deploy
Plugin is likely your best shot.
Not sure which features of that SDK you're using, but you could try using the Cordova plugin they provide. Capacitor supports using some Cordova plugins.

Import from node_modules into Svelte

Let me preface this by saying my knowledge of node apps and javascript is very limited, all my programming knowledge comes from a python data analyst background.
So, I am trying to learn frontend and build an app in Svelte. I will serve this app with another backend so I will not be using SvelteKit. I am also using Ionic for my UI framework. I will probably use Routify for routing but this is beyond the scope of this question. Also, I know svelte isn't officially supported by Ionic but i'm not interested in using another framework.
The simple method would be to include the Ionic CDN in the svelte index.html. However, I would like to keep my files in one place when I build the final app and not require a CDN or even possibly a network connection if I decide to use Capacitor to build for mobile devices. So, I'm not sure how to proceed. I would like to bundle Ionic (Ionic/Core - IonicIcons) with the default JS and CSS bundles that svelte builds using Rollup. Googling around a bit iv'e discovered I apparently need to use something called "rollup-plugin-css-only" to bundle the CSS and somehow include the JS files in commonjs in the "rollup.config.js". I tried adding the path to the JS files to commonjs but I couldn't see any changes to the bundled JS the svelte outputs. I also have no idea how to use add the css or use "rollup-plugin-css-only". Instructions and explanations iv'e found haven't been very helpful.
So, in summary... I'm trying to bundle Ionic into my svelte project without using a CDN and haven't figured out how too do it yet. I also may not be understanding this workflow correctly so let me know if I got something wrong. I just need an explanation or example of Ionic bundled in a svelte app. I would also like to mention that the workflow I am looking to accomplish will also allow custom themes in Ionic with the CSS processing.

Can you tell me more about global configuration

I have read in flutter.dev about global_configuration it is:
"A flutter package for managing different configurations by merging them together and making them available everythere inside the app via a singleton."
this link of global_configuration library
but honestly i didn't understand much about what the library dose i searched in youtube and google didn't find much about it if you can tell me where to use it and what its benefit i would very glad and thank you..