flutter_pref icon indicating copy to clipboard operation
flutter_pref copied to clipboard

Request: Error Message, when pref not found in default values

Open Mercutio1243 opened this issue 2 years ago • 0 comments

Preface: I am relatively new to flutter.

It took me some time to find out why my setting pages was freezing without any comment or error: the identifier I provided in "prefs:" was not the same as defined in the "defaults", used in setting up final service = await PrefServiceShared.init(defaults: ...)

Since this might be a quite common mistake, a small error message might be helpful.

Edit: It might also be that the freeze came due to some information provided in default not being the appropriate variable type.

        PrefDropdown<String>(
          title: Text('Analysis time'),
          pref: 'identifier1',
          items: [
            DropdownMenuItem(value: '500', child: Text('500 ms')),
            DropdownMenuItem(value: '750', child: Text('750 ms')),
            DropdownMenuItem(value: '1000', child: Text('1000 ms')),
          ],
        ),

Mercutio1243 avatar Jan 04 '24 10:01 Mercutio1243