PreferencesProvider | multiprocess supported replacement of Android
kandi X-RAY | PreferencesProvider Summary
kandi X-RAY | PreferencesProvider Summary
A replacement of Android SharedPreferences based on ContentProvider. It solves the problem when we have to store/use preference values across process. Inspired by the great work of grandcentrix/tray, but PreferencesProvider has a much simpler implementation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Open data not exist
- Query the content for a module
- Print an INFO message
- Returns the float value associated with the given key
- Called when the application is created
- On create
- Show all items
- Returns all preference items for the given module
- Prints a log message
- Log to file
- Insert data
- Insert data into preferences
- Applies the given operations to the content provider
- Returns true if there is a projection
- Print message to stack trace
- Initializes this component
- Returns the type of the URI for the given URI
- Adds text to the selection
- Get the number of documents
- Write a debug message to the console
- Query data
- Returns the query parameters for this content provider
PreferencesProvider Key Features
PreferencesProvider Examples and Code Snippets
String stringValue = myModule.getString("non-existing-key-2", "defaultValue");
boolean boolean1 = myModule.getBoolean("non-existing-booleanKey1", false);
boolean boolean2 = myModule.getBoolean("non-existing-booleanKey2", false);
int intValue = myModu
resValue "string", "preferences_provider_authority", "${applicationId}.preferencesprovider"
defaultConfig {
applicationId "com.ddmeng.preferencesprovider.sample"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0
repositories {
jcenter() // If not already there
}
dependencies {
compile 'com.mengdd.preferencesprovider:preferences-provider:0.2.0'
}
Community Discussions
Trending Discussions on PreferencesProvider
QUESTION
I have a app class that returns a MaterialApp()
which has it's home set to TheSplashPage()
. This app listens to the preferences notifier if any preferences are changed.
Then in TheSplashPage()
I wait for some conditionals to be true and if they are I show them my nested material app.
Side Note: I use a material app here because it seems more logical since it has routes that the parent material app shouldn't have. And also once the user is unauthenticated or gets disconnected I want the entire nested app to shut down and show another page. This works great!
But my problem is the following. Both apps listen to ThePreferencesProvider()
so when the theme changes they both get notified and rebuild. But this is a problem because whenever the parent material app rebuilds, it returns the splash page. So now I am back on TheSplashPage()
whenever I change a setting on TheSettingsPage()
.
So my question is how can I stop my application from going back to the TheSplashPage()
whenever I change a setting?
Main.dart
...ANSWER
Answered 2020-Apr-11 at 13:37basically there's 2 ways in using a provider
- one it the current one you're using which is the consumer type,
- is using the instance of a provider
QUESTION
I am building a RegisterPage in flutter and I devided my scaffold into two containers. One for the top half and the other for the bottom half so that the logo/headline can be in the top half and the form be in the bottom half.
Now I noticed after testing on android that the keyboard overlaps the input fields. So I added a SingleChildScrollView() view to fix this. But there is a problem. The content appears to be too big and you can now always scroll even when the keyboard is down. I added a video to demonstrate what I mean.
I think that this space is responsible for that
It looks like that space is reserved for the android navigation bar. How do I remove that? Or how can I size my containers in such a way so that they account for that? Just to be clear the thing I want to know most is how I can stop my SingleChildScrollView() scrolling when the keyboard is down, which is probably cause by the containers being to big.
the_register_page.dart
...ANSWER
Answered 2020-Apr-01 at 14:21You're very close. Setting the SystemChrome
color to transparent just makes them see-through but won't draw your app over top of the navigation or status bars. The fix is a 2 step process.
Set
SystemChrome.setEnabledSystemUIOverlays([SystemUIOverlay.top])
to display only the notification bar orSystemChrome.setEnabledSystemUIOverlays([])
to display your app in full screen.In your
Scaffold
set theresizeToBottomInset
property tofalse
when you want the screen to display over top of the bottom system UI overlay and totrue
when the keyboard is up.
Full code example:
QUESTION
I am building a app where I want to check if a user is logged in and if not I build a certain widget tree. So if the user's auth state changes it rebuilds the entire tree. So you land on the splash page and the splash page waits until it knows if you logged in and either returns the RegisterPage or the GroupManagementPage which is basically a page where you can see all your groups kinda like whatsapp but instead of conversations you have groups. The problem is I just can't figure out how to do this properly.
I am using firebase auth and what I currently do is I provide a AuthenticationProvider all the way from outside my main app. In my splash page I use this provider's stream (which is basically the onAuthChanged from firebase but mapped to a AuthenticationCertificate) in a stream builder I wait until the stream is active before I build the rest of my widget tree. If the stream is active I provide my AuthenticationCertificate to the GroupManagementPage.
So that's working but problems arise with the navigator. Because in my MainApp() I defined my splash page as my home route. So now whenever I pop a route I go back to the splash page, which is not what I want. I also noticed that there are some pages which do not get provided with the AuthenticationCertificate. I am not sure why yet because the Navigator also passes the context, still have to look into that.
Now my question is how can I get this working properly so that the AuthenticationCertificate is passed to all the widgets that get navigated to from the GroupManagementPage and when the user logs out it goes back to the RegisterPage? Is this the right approach and how could I make this work?
Main app
...ANSWER
Answered 2020-Mar-28 at 16:45Use StreamProvider instead of Provider if you want to use Stream. But I don't know why you'd like to use Stream for such a case. Why not ChangeNotifierProvider?
Navigate to your pages with Navigator.of(context)
. The navigation part of your code is strange. You return TheGroupManagementPage() or TheRegisterPage() in the build function of TheSplashPage(). This is not how Navigator works. You should use methods of Navigator like push
, pop
, pushNamed
etc.
QUESTION
I have a multiprovider that has an authentication provider and a user providerm and is wrapped around the main app. The authentication provider has an async method that returns a Future
. The user provider has a stream that needs that authentication certificate. So how can I get the certificate into my user provider?
This is my multiprovider which is wrapped around the main app
...ANSWER
Answered 2020-Mar-26 at 00:55Try removing the StreamProvider from the multi-provider list and wrap it around the class that needs it at creation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PreferencesProvider
You can use PreferencesProvider like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the PreferencesProvider component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page