I'm setting up a new flutter-web application but I can't add dependencies that I could do in flutter.
for example I want to add font-awesome-flutter to the project but get this error!
font_awesome_flutter: 8.5.0
Because font_awesome_flutter >=8.0.0 depends on flutter any from sdk which is forbidden, font_awesome_flutter >=8.0.0 is forbidden.
So, because salema depends on font_awesome_flutter 8.5.0, version solving failed.
since flutter-web is not still stable and its in technical stage, a simple way for using library in flutter-web which has been working for me is to add the library resources manually. you just need to copy everything inside the lib folder of the library in your own project.
in order to access the library's resources go to https://pub.dev/flutter and search for the library you want and then find the library's github repo in the about section.
flutter_web does not have a plugin system yet. Temporarily, we provide
access to dart:html, dart:js, dart:svg, dart:indexed_db and other web
libraries that give you access to the vast majority of browser APIs.
However, expect that these libraries will be replaced by a different
plugin API.
Source:
https://github.com/flutter/flutter_web/blob/master/README.md
In short, Flutter dependencies are not supported by Flutter Web at this time.
Related
I'm trying to implement new Flutter plugin to wrap my native SDKs and use my native SDK directly and return the result.
I already finished the Android part by adding my library using maven and use it inside my Android module, but now I'm stuck on iOS part as the plugin code is just a pod that will be used at the end so how I can add my dependence via Swift Package Manager to the plugin pod and use it instead of going and add vendor frameworks. Is there any way to do that?
Currently you likely need to switch to CocoaPods.
Flutter does not support Swift Package Manager. See https://github.com/flutter/flutter/issues/33850
I am working on a Flutter project where I have a mobile application and a web application both are different e.g. one of them is a client application and the other one is the admin panel. But they have so many common files e.g. models and utils. But their dependencies are entirely different e.g. firebase for flutter(iOS and Android) and firebase for Dart.
I want to share common files between 2 projects but I want to keep their dependencies separate as I don't want to build useless dependencies with another project.
How can I do this? I have good experience with Android Flavouring but I am unable to accomplish this here. can I have separate dependencies for both? I googled and found much data regarding flutter flavors but I couldn't find my answer.
You can try to create a flutter package and share the package between the projects
see
https://flutter.dev/docs/development/packages-and-plugins/developing-packages
create the package (e.g. my_pkg) in folder next to your app folder
move the files you want to share to the my_pkg project
then in your puspec.yaml you can do this
dependencies:
flutter:
sdk: flutter
my_pkg:
path: ../my_pkg/
the only other change in your code would be the import statements of the class that you moved to my_pkg
Hope it answer your question.
The mapbox gl package page lists it as suitable for web applications (mapbox_gl).
I tried running the example as a web application, but I encounter the error Error creating mapbox_gl_example|lib/move_camera.ddc.dill
Error creating kernel summary for module:mapbox_gl_example|lib/move_camera.ddc.dill
.
So, my question is, is the flutter package mapbox_gl actually able to be run as a web application as the tags "FLUTTER ANDROID IOS WEB" suggest (is there something I must configure), or is it really not web capable as may be indicated by the fact that the actual description mentions nothing of web capability?
Update: The mapbox_gl flutter plugin now has web support merged into master on Github. If you don't want to wait until web support is released to pub.dev, you can depend on the Github repo directly with this dependency in pubspec.yaml:
mapbox_gl:
git:
url: git://github.com/tobrun/flutter-mapbox-gl.git
Outdated answer: Unfortunately, it doesn't support web yet (although PRs are welcome if you want to contribute). The reason it was listed as supporting web (like many other plugins) was that flutter changed the way plugins declare their supported platforms in the pubspec.yaml file. The mapbox_gl package has since been updated on pub.dev and now correctly shows that it only supports Android and iOS.
I am new to flutter plugin development, I have read Developing packages & plugins and Writing a good Flutter plugin, but I am confused as a beginner, I have developed Flutter Application based on webview_flutter and a JavaScript library to work offline. I want to extend it as a module or a plugin.
Webview renders some stuff.
JavaScript library is being attached from assets.
I am not calling any Platform API directly from my code but my code depends on another plugin.
How do I proceed this? As a plugin or as a module?
A plugin is about making native functionality available to Flutter.
A module is about integrating Flutter with an existing native application.
Perhaps what you actually want is a reusable Pub package that you can publish to pub.dartlang.org (a plugin is also a Pub package, just a special one that additionally utilizes access to the native platform)
See also
https://flutter.io/docs/development/packages-and-plugins/developing-packages
https://www.dartlang.org/guides/libraries/create-library-packages
A "library package" is a Pub package in contrary to a plain Dart "application package" which is usually not published to pub.dartlang.org.
A pure Dart Pub package (library package) that does not depend on dart:html, dart:ui (Flutter) and is not a Flutter plugin, can be used on any platform (server, command line, Flutter, browser).
If your package has one of the named dependencies, it is limited to a specific platform.
pub.dartlang.org shows labels to categorize published packages accordingly (FLUTTER,WEB,OTHER)
Flutter plugins:
In short: Native related developments.
Flutter plugin is the wrapper of the native code like android( Kotlin or java) and iOS(swift or objective c). ... Flutter can do anything that a native application can through the use of Platform Channels and Message Passing. Flutter instructs the native iOS/Android code to perform an action and returns the result to Dart.
Flutter packages or modules:
In short: Make the development faster by using code from util libraries.
Flutter supports using shared packages contributed by other developers to the Flutter and Dart ecosystems. This allows quickly building an app without having to develop everything from scratch.
I have a library our partners use to drop our UI and flow into their apps. Can I make a cocoapod or framework file or an aar file or gradle dependency with a flutter project?
Yes! For general information, see https://flutter.dev/docs/development/add-to-app
To create an AAR from a Flutter module that other Android apps can use without any direct dependency on Flutter, see Option A - Depend on the Android Archive (AAR)
To create a Framework from a Flutter module that other iOS apps can use without any direct dependency on Flutter, see Option B - Embed frameworks in Xcode
You can also find samples at
https://github.com/flutter/samples/tree/master/experimental/add_to_app, refer to the respective samples: android_using_prebuilt_module and ios_using_prebuilt_module
Now, if you are talking about integrating Flutter into an existing library (AAR or Framwork), then no, this is currently not supported, but is being explored:
https://github.com/flutter/flutter/issues/39027
note that this would be termed “add-to-library” as opposed to "add-to-app"
also mentioned, flutter/add-to-app:
Packing a Flutter library into another sharable library or packing multiple Flutter libraries into an application isn’t supported.