I'm in a situation where I could really use functionality to change meta-data in manifest at run-time in my Flutter app. As per my understanding, the androidmanifest.xml elements are only set at compile-time. While trying to find some solution, I came across this and this which says otherwise.
Now I'm curious to know if it is really possible to update these meta-data(s) at runtime? If yes then how to implement this functionality on Flutter?
Yes, updating meta-data is possible in Android, but it's limited to some tags.
About modifying them via Flutter, just like any other platform-specific API, you should use channels:
https://flutter.dev/docs/development/platform-integration/platform-channels
It looks complex but easy to use. Check the battery level reading sample above, it's quite clear.
Related
Is it possible to display multiple buttons/actions in a toast or snackbar using the .Net Maui Community Toolkit? If so, can you provide an example please? if not, is there another way to achieve this.
I have looked at all the documentation I can find but have not been able to find a way
Unfortunately this is not possible. On Android it uses the platform implementation as this concept is actually something that comes from Android. And on Android you cannot have more than 1 button on it. On other platforms we draw our own SnackBar/Toast, but to make sure it is consistent across platforms, we only allow 1 button to be on there.
I have one project that I have to sell to another clients, so I wanna found a way to unify the code to, when I release some updates, I have to manipulate only one code (and, of course, keeping the specificities from each one)
I found an article HERE which the guy creates a new folder named 'config' and set some variables there to be used in the parent project. I tried this but find out that would be very tough to do because the first app was developed specifically by one client, and with it I would need so much time to make all the aspects dynamic... Another problem is firebase, in first app I used firebase but in the second i won't. How to make it possible?
And in this article they say about 'flavours' that can be used to do something similar.
Someone knows about this approaches or there is another to reach my goal? With flavours I will have less re-factor than with config?
I appreciate any help
A third way to do this with no client specific app configuration is to make an api call to get back your client specific theme, and then set the flutter theme based on this.
If you need web support see below:
First update your assets in index.html that aren't white labeled, leaving stubs in their place that we'll fill in later. i.e.
Next show a nice loading indicator while flutter loads. To do this, just put the html for it in the body element of the index.html file.
Finally update the webpage title and favicon using javascript inside Flutter. I used package
universal_html: 2.0.8
https://pub.dev/packages/universal_html
then you can update the favicon
import 'package:universal_html/html.dart';
var favicon = document.getElementById('favicon');
favicon?.setAttribute('href','insertLinkToYourImage');
Updating the title can be accomplished in various normal ways like just setting the title attribute of a MaterialApp widget.
Looking for a UI integration test strategy for Flutter. We'd love to use Silenium/Ghost Inspector but seems that is not practical due to lack of html id's or CSS classes in Flutter (Add id or name property or other means of identification for Flutter Web applications?). Or has anyone found a way round that?
In the meantime Flutter Driver has only very basic documentation for simple tests like finding a button and pressing the button. Anyone know if I can do other operations like navigate to a specific page (e.g. using a # url fragment), test a link which leads to an external site, check visual setup of the page against an image, and other such tests which would be standard in Silenium and the like.
Thanks!!
Well seems Flutter Driver is still very limited so I have instead found a strategy for using Selenium, posted full details here:
Strategy to use Selenium browser testing with Flutter Web apps
Please note i am not talking about the .abr files.
I have been following several tutorials on internationalization in Flutter using the intl package. I noticed that they always use a single AppLocalization class for storing all the messages that will be used in the application. Since it was a tutorial, I am wondering if we will always have to do it that way. I mean in a real application we will probably have hundreds messages to maintain. It would be a mess to put them all in a single class.
Maybe we should have a localization class for each Page?
What are your suggestions?
Flutter Intl package it's the right solution; also i used to Easy Localization.
This package has a "inherited widget " concept, so if you want to change automatically change UI for changed Local Language, it will be quite useful to you.
Maybe you want to localization JSON update to server and use application new key-value without deploy store. EasyLocalzation does read the server-side JSON file.
Since I basically can get the same info with both approaches, I'm wondering which is the preferred one and what are the advantages using one over the other?
$cordovaGeolocation is angular wrapper over plain javascript plugin, developed by ionic. Now question is why ngCordova was introduced,in simple words to deal it as plugin service as module and inject plugin wrapper as dependency to only particular controller or service.
On Pratical level, cordova developers were having issues with plugins on angular project. One simple issue was that $scope does not get updated sometimes in simple plugins callback.
Quoting from ionic blog post :
The services support promises to make it easier to deal with their
asynchronous nature and ensure scope data is properly updated.
So my conclusion is, you should go with $cordovaGeolocation.
As far as I remember, on Android that plugin does not do anything at all, and on iOS it prevents the OS asking for access to location over and over.
Overall the plugin totally conforms the html5 specs, so you shouldn't change anything in your calling code (in js) if you use the plugin.
And the plugin has a good documentation here: https://github.com/apache/cordova-plugin-geolocation/blob/master/doc/index.md
It is worth noting that according to the current and oficial documentation (see cordova geolocation doc), there is no need to use $cordovaGeolocation, but rather the global object navigator.geolocation.