I'm using deferred in flutter for split code into a separated file, but it work done with android and web and also with windows, but about ios and mac doesn't good and make a problem, anyone knows more about it, or use it?
I get more info about it, in this link deferred component
can I write a condition on it,like work only for a specific platform?
thanks.
Related
I'm considering building my app with Flutter because of the attractive cross-compilation features, native feel, and speed of development.
I need to use an advanced audio processing library to be able to make my app, so the options I was considering are either to use JUCE through CocoaPods (a C++ audio library) or AudioKit (a Swift audio library) with Flutter.
I think JUCE is definitely possible to use with Flutter as I've seen two github projects which seemed to implement it (https://github.com/audiooffler/JucyFluttering and https://github.com/tomduncalf/juce-flutter-integration). I haven't been able to get it running on my own setup though, the build succeeds but when I use the first link (JucyFluttering) but I get an error as follows: https://justpaste.it/9c8xe. I've tried to look into it for a while and couldn't figure out what is going wrong. If anyone has an idea or approach to move from here
The other option I was considering is building an iOS only app for my prototype using Flutter and AudioKit (Swift-based), and then reusing the Flutter UI code with JUCE when I want to move to cross-platform. However, I'm totally clueless on how to go about bringing AudioKit into my Flutter project. The library is not on pub.dev so including it in my pubspec.yaml file, I get the following: "Because audiokit_flutter depends on audiokit any which doesn't exist (could not find package audiokit at https://pub.dartlang.org), version solving failed." when I try to run "flutter pub get".
I'm not even sure if the AudioKit approach is viable, but if anyone has any relevant knowledge, please share it with me! I've been trying to figure this out for weeks and it has been very frustrating! I would very very much appreciate the help.
Thank you so much!
I'm building a Flutter app that will have the capability to execute some actions when the device connects to another bluetooth device. This app should work on Android and iOS but for the sake of simplicity I'll focus on Android in this post. Also, this has to work whether the app is in the foreground, in the background or killed.
Here is the architecture of the app:
I have an Android native code that registers to bluetooth events through a BroadcastReceiver.
I followed this tutorial to set up the communication between the Android code and the Flutter code: https://medium.com/#chetan882777/initiating-calls-to-dart-from-the-native-side-in-the-background-with-flutter-plugin-7d46aed32c47.
When the Android BroadcastReceiver is triggered by a bluetooth event, the information is sent to the Flutter code (even if the app was in the background or killed). A Flutter isolate is created to handle the Flutter code.
Everything works perfectly well. The Flutter code is called and I can use print(data) to log the data that have been provided by the Android code.
Things are becoming more tricky when, from the isolate, I want to call any Flutter plugin (like sqflite, package_info_plus, ...). I get this error every time:
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception:
MissingPluginException(No implementation found for method xxx on
channel yyy)
I understand that spawned isolate can't natively run Flutter plugins. There are some posts (Unable to understand Flutter Isolate workaround for "'Window_sendPlatformMessage' (4 arguments) cannot be found" error, https://github.com/flutter/flutter/issues/13937) that explain how to create isolates that can run Flutter plugins by using a workaround or a plugin like https://pub.dev/packages/flutter_isolate.
However, I can't create the isolate with this package because the isolate is created from the Android code.
Can one of you tell me how I can achieve this? Is there a way to use Flutter plugins from an isolate that has been created by native code?
Thank you very much in advance
Sounds like the way you create the Flutter isolate may not be compatible with your goal. There are some solutions to integrate Flutter with native Android/iOS projects, such as flutter_boost (disclaimer: I have not tried it and not sure good or not; you may find many other alternatives as well, this is just an example). You can use that to create the Flutter environments. Since the solutions above allow some Android code to open a new normal Flutter page and Flutter code in that page is able to do anything (of course include calling native - otherwise things like flutter_boost is really useless), this should work.
Hi stack overflow community,
I'm a novice programmer in high school and have never written an app for mobile devices before so please bear with me. If I was to write an app using Flutter, will I only be required to write the code once and then be able to distribute different versions of it (iOS, macOS, Windows, Linux, Android, etc)? Or will I need to make small changes for each version such as using XCode to create the iOS version and Android Studio for the Android version? I know this is such a basic question but I've spent a couple of hours looking this stuff up and I'm still confused. Any help would be nice.
Thanks,
Daniel
In a product development environment, after writing the cross-platform code with Flutter, there are some need-to-do tasks related to Native environment.
In the case of Android, there are several cases when you'll need to touch the Native level such as config Firestore settings, Social authentication (Login with Facebook for example), changing the launch icons/ splash screen of the app or publishing to app store, etc
For iOS, the same case apply as well. So I suggest you start with small steps to develop the app first, then when running into something that seems impossible with just Flutter code, there are tutorials and SO to guide you through. It might seem overwhelmed at first, but we are all on a journey, so no need to rush it ;)
You should make small changes too. For eg when adding launcher icons and splash screen you have to edit the respective native folders. When distributing for ios you need to manually customize its Runner from xcode. There are many library that support either android only or ios only. In that case if you need that feature you have to make changes in native code like java ans swift.
if you're creating your own native plugins, you will have unique code to write. But if you're just using things out of pub, almost nothing will require change (unless you are publishing to the store).
I have trouble in setting flutter and running an app on a real device in vs code. I want to run my apps on physical device and I do not want to use emulators. Is it going to be possible?
Yes, this is very possible. In fact, many flutter developers use physical devices in order to test features like Maps,Camera, etc. I always recommend following a video tutorial to set up environments for development. But you should try the following:
First of all, I recommend the flutter docs https://flutter.dev/docs/development/tools/vs-code to set up vscode.
After this, all you need does not have anything to do with VSCode any longer. You should check https://flutter.dev/docs/get-started/install/windows to connect a physical device.
Im not sure if you have already setup flutter on your machine to start with. If you haven't use this link how to install flutter
the next part is easy just install dart and flutter extensions in vscode.
walla!
To be more precise, I already have a huge app writen in Ionic and now we're considering to migrate it to flutter, but we can't rewrite it from scratch, both ionic and flutter should coexist.
So my question is: can I have a flutter app as a "host" and import / run the ionic app inside it? Something like a micro frontend.
Until now I was able to build the target ionic app and import it on the flutter app, under android folder, but it does not feels like a productive way to approach the problem.
I also googled a little bit about this integration, but did not find anything that solves this problem.
I appreciate any help on this topic.
Yes, it is possible, but very cumbersome.
I did it for a project and embedded 3 ionic apps inside flutter.
I'll not list every problem that i faced but just go through some points to give you an idea.
You will need to take care of some cordova plugins that use native code, for Android copy and paste some folders like CordovaLib,cordova and use it as a library. For iOS you must add the plugin files like *.h to the compiles list inside Xcode and create an Pod to get the cordova resources (that's the way i did)
To "launch" the app for android you need to start the cordova activity and for iOS you need to play with UINavigationController and FlutterViewController, and of course create a method channel to be possible to call it from Flutter.
For multiple apps, you have to mess inside de cordova code to get the app from the right www folder and be sure to equalize every plugin version between apps.
Some packages from flutter may clash with ionic/cordova libs
Every change you do to your ionic application it must be tested outside flutter and within it to see if there's any mismatch behavior that you didn't expect, specially when adding new plugins.
Maybe some permission issues will arrive between applications like camera or localization.
I know thats not the answer, but when searching on how to do it, i stumbled upon this question a few months ago and it still without any answer on this problem.
But my final take is that the effort of joining together all pieces using multiple languages and frameworks together with the job of maintaining this spaghetti behemoth is not worth it and you'll save yourself of a tremendous headache.