How to dynamically download and execute Dart code in a flutter app? - flutter

I have a flutter mobile app and i would like to be able to download dart code into the app and execute it. The downloaded code is fully trusted i.e. it comes from API calls to the mobile apps backend. There are two cases.
Non UI downloaded code: This is downloaded dart code that can interact with the network and and do some data structure transformations. It might also want to interact with the SQLLite database used by the app.
UI code: code that can interact with specific widgets on the screen or draw new widgets?
Can the above two dynamic code execution be done in a production flutter app that has been complied to native code?

Related

How to upload image in flutter Integration Test?

I have one image file that I need to upload it in Integration Test Flutter. I am not getting any help from Flutter : Integration Test documentation
I have created one folder
test_upload_files and added .png file in it and wrote the object identification of Upload Feature
then I have fetched the path of the file and tried to upload it but there are no predefined methods to upload.
I got stuck here, how to automate this Upload Functionality ?
and there is one more catch, need to enable location or camera which is from Native app, is there any solution to enable these services by default, like how we do it in Web applications using Browser Desired Capabilities?
By using flutter code can we interact with Native apps of apk and ios ?
[1]: https://i.stack.imgur.com/wvBLr.png
See the Patrol project – it lets you interact with native permission dialogs, and basically everything, from within your Flutter integration test written in Dart.
This issue demonstrates how you'd upload a single file on Android.
Disclaimer: I'm the main developer of Patrol.

Can you make complete apps using Flutter & Dart or just the UI part of an app?

I'm confused about what Flutter framework actually does, I know that it uses Dart and have heard that both of them can be used to create cross-platform apps.
But Wikipedia defines Flutter as a "UI Framework", so my question is, can you make a complete app (for mobile) which also has backend part (communicates with a database) built entirely using Flutter & Dart and not only the UI part?
Yes, we can obviously build complete apps using Flutter, from UI part to backend as well. Using Firebase as a backend service, we can use it for authentication, database, hosting and all.

FLUTTER WEB: How can we have a single codebase for the Flutter app & Web?

We have a single codebase for Android & iOS in Flutter.
We tried to use the same codebase for Web in Flutter too, but it hadn't gone well.
As of some libraries/plugins, currently unsupported by Flutter SDK.
To mitigate these issues, we are maintaining two separate repositories, one for Android-iOS and other for Web.
Also, to add up here, for separate repositories because each Flutter product has a unique pubspec.yaml file. Now there are a few plugins that are currently supported in App but Not yet on Flutter Web, namely Awesome Notifications, Clevertap plugin, etc.
Integrating those plugins on the web, stops the web to run. So keeping the same codebase for both is getting technically complicated as the app has many many functions.
It takes so much time in simultaneously testing, debugging and resolving issues in Web.
So, how we can maintain same code for all platforms i.e., Android, iOS & Web, without doing it in other repository for Web and gaining advantage in streamlining our codebase into one for all platforms?
For Ex. If I commented the package awesome_notifications for Web in pubspec file, the issue arises (as shown in the screenshot) in code wherever we used its functionalities.
For successfully working on both Mobile & Web, are there any methods available we can use packages for both (Mobile & Web)?
Ideally you’d want to use a single codebase to host both the web and mobile versions, to minimise code maintenance and improve efficiency. To do this, you’ll need to be able to find the platform the code is running on, so that code can be called programmatically.
You can use the constant kIsWeb to check if the application is compiled for the web, and you can then use that condition to only run platform-specific code (such as the awesome_notifications package) if you’re on a platform that supports it. That way you’ll still be able to import the required packages, but only call them when the app is running on the mobile version of your app.
That should allow you to condense your codebase into one repository without sacrificing any functionality that may not work across all platforms.

Flutter: Launch my other application from flutter application and get some data back

Using flutter to launch other applications on both the platform (Android/iOS). I know we can use url_laucher to launch applications like Gmail or Google map.
Can it also be used for launching my own application?
If "YES", is it possible to get some data back from my other application to flutter application?
If "NO" then is there any other way to do this. My goal is to get the data (like a simple string) back from my other app.
NOTE: Constraint is that I have to use flutter Widgets or packages and not touch the native directories.
Yes, you can use url_launcher to launch your own application provided your application has appropriate url schemes defined.
No, you cannot get back any data by launching an application with url_launcher
Is there a way to achieve this only using flutter widgets and existing plugins?
Yes, only on android. There seems to be a flutter_share plugin that allows you to share data to other apps and receive data shared by other apps.
Hope that helps!

Difference between react and ionic framework

I have read some docs and i do not really understand what are the differences between react and ionic frameworks.
Is one of them made from the other ?
I have to store local data. I suppose one of them is just web and javascript so data is only stored on server ? Or is it possible to do local storage with both of them.
Is it possible to host the app on a web server without having a "real" app ?
Thanks
Hi I think that you are a little bit confused. I hope this clarify your doubts:
Ionic framework is a set of tools for create Hybrid apps using html/css and javascript, It is build using apache cordova and Angular 1. In the other hand you have React a library for build rich UX(User experience) web apps.
Ionic is not build on react. They are different purpose tools but you can use that together (Using IONIC 2).
In both cases you can use local storage, but if you want to store data in servers you have to build your own backend to provide data to the app They are front end oriented frameworks(no server side)
You can put Ionic code on a server it is simple JavaScript and HTML but this is not the purpose of the framework and if you do it, you loose the native apis of the device. In the case of React it is just a library and you can use it in an existing project using HTML and Javascript or build your app entirely with it.
You have a long road ahead, hope this help you.
Ionic is an HTML5 mobile app development framework targeted at building hybrid mobile apps. They are essentially small websites running in a browser shell in an app that have access to the native platform layer.
React Native is the next generation of React – a JavaScript code library developed by Facebook and Instagram, which was released on Github in 2013. React Native lets you build mobile apps using only JavaScript.
They have their own way of functioning, below are few points on their differences:
Ionic is a regular web app, written using HTML, CSS, and JavaScript, but it runs in a webview embedded in a native app instead of in a stand-alone mobile browser
React Native has a completely different architecture: instead of writing your UI using web technologies, it uses the React component model to render to native views.
Ionic is a Cordova based app that wrap current web app into a mobile application. It uses the android existing web view to render the app so the file size is quite small
Meanwhile react native create bridge between JavaScript and native component.
When it comes to memory usage, Ionic framework uses more than react native apps
The Ionic app is slower at loading videos because it needs to download from other server, while in react native, it caches the tiles so it loads faster.
When it comes to integration, react native can use every client based JavaScript modules from npm (node package manager) whereas Ionic uses only the Cordova-based code.
Ionic is a framework that creates an idea of writing code only once
React native is not a write once and run anywhere framework, but is popularly touted as a “learn once, write anywhere” framework
Ionic Framework app needs to use device features and APIs through Apache Cordova plugins.
With react native you can access any device component or API
Based on the points above, you can see the difference in their functionalities, so if you want to go for something that creates performant iOS and Android apps that feel at home on their respective platforms ten you can opt for React Native.
And, if you are targeted at building hybrid mobile apps, Ionic is the best choice!