setString method

Future<bool> setString(
  1. String key,
  2. String value
)

Saves a string value to persistent storage in the background.

Note: Due to limitations in Android's SharedPreferences, values cannot start with any one of the following:

  • 'VGhpcyBpcyB0aGUgcHJlZml4IGZvciBhIGxpc3Qu'
  • 'VGhpcyBpcyB0aGUgcHJlZml4IGZvciBCaWdJbnRlZ2Vy'
  • 'VGhpcyBpcyB0aGUgcHJlZml4IGZvciBEb3VibGUu'

Returns false if the platform implementation can definitively determine that storing the preference failed. A return value of true indicates either that the value was written successfully, or that the underlying platform API does not report success or failure.

Implementation

Future<bool> setString(String key, String value) => _setValue('String', key, value);