Unhandled Exception: NoSuchMethodError: The method ‘setString’ was called on null

Your _sharedPreferences instance is not initialized.

Future<bool> commit() async {
    _sharedPreferences ??= await SharedPreferences.getInstance();
    await _sharedPreferences.setString(ID, id);
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top