Do iOS and Android Flutter widgets also work on Flutter Web(PWA)

Issue

I’m interested in using Flutter primarily for my startup MVP on Web and possibly Android. I see the flutter community has made a lot of widgets but a lot of them are tagged iOS or Android. Since Futter is all about using one codebase is it wrong to assume that these widgets would work on web too? I imagine the setup would be different but similar with a Flutter web app as opposed to a Flutter Android app.

I couldn’t find a whole lot about this on the Flutter site. I also know that web is still beta but by the time I’m done with the MVP it’ll probably be at stable release or close enough.

Solution

Well… It depends. If the widget has some sort of native code the answer is no. In Flutter there are two type of packages: the "normal" package, and the plugin.
The packages are made only of dart code, so there are no bounds to native, and you can use everywhere dart (and Flutter) can run.
The plugins are packages with native code and you can use only on the platform supported by that plugin.
For example the package provider, it’s a package, and you can use in every supported platform where dart (and Flutter) can run. But url_launcher, it’s a plugin, so you can run only on Android, iOS, and web, but for example on desktop, it will no work.
If the package if you found it’s only a widget, you should be able to use on the web.

TLDR: No,a PWA it’s a web app, so it can’t run Android or iOS specific code.

Answered By – Gioele Pannetto

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *