setUserDataBool static method
Sets a key-value pair identifier that will be included in all snapshots.
This identifier can be used to add the bool
types.
The key
must be unique across your application.
The key
namespace is distinct for each user data type.
Re-using the same key
overwrites the previous value
.
The key
is limited to maxUserDataStringLength characters.
A value
of null
will clear the data.
The value
is also limited to maxUserDataStringLength characters.
This information is not persisted across application run. Once the application is destroyed, user data is cleared.
Data can be removed via removeUserDataBool.
Method might throw Exception.
Implementation
static Future<void> setUserDataBool(
String key,
bool? value,
) async {
try {
if (value == null) {
removeUserDataBool(key);
return;
}
final arguments = {"key": key, "value": value};
await channel.invokeMethod<void>('setUserDataBoolean', arguments);
} on PlatformException catch (e) {
throw Exception(e.details);
}
}