Problem with the use of SharedPreferences with dart and flutter

0

Hello, I had problems getting data from an instance of SharedPreferences, this is my code:

  _getToken() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    var token = (prefs.getInt('TOKEN') ?? "");
    print(token);
  }

when starting the program shows the following error:

ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
                                                      type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, Object>' where
                                                        _InternalLinkedHashMap is from dart:collection
                                                        Map is from dart:core
                                                        String is from dart:core
                                                        Object is from dart:core
    
asked by Manuel Alejandro Garcia Gutier 16.04.2018 в 21:19
source

0 answers