Flutter Settings Screen with Shared Preferences

First stable version of Flutter came out on 4th of December, 2018. Even though the community is growing rapidly since then, there is no built-in solution for managing your application’s settings neither on Flutter nor on Android.

But almost every application needs settings and a way to manage it, probably with Shared Preferences, right?

After I got familiar with the Flutter development I decided to make a library to solve this problem.

You can create a list based menu structure and choose from different input widgets like toggle screen, checkbox, radio button, switch, slider, color picker, and simple text field. A screen with a checkbox looks like this:

SettingsScreen(
    title: "Application Settings",
    children: 
        CheckboxSettingsTile(
            settingKey: 'key-of-your-setting',
            title: 'This is a simple Checkbox',
        ),
    ,
);

To retrieve these values anywhere in your application code, use the simple StreamBuilder based async methods like:

Settings().onBoolChanged(
    settingKey: 'key-of-your-setting',
    defaultValue: false,
    childBuilder: (BuildContext context, bool value){
        return Text(value.toString());
    },
);

Check out the project repo for more examples and detailed documentation.

Do you like this library? Star it or comment below.

Written by
Barnabás Bartha
BarthaWEB

About Me

Barnabás Bartha

My goal as a developer to increase the revenue of businesses by consulting and turning ideas into efficient solution in Web, Mobile, Cloud, DevOps fields focusing successful problem solving rather than used tools.