setUserDataInt static method
Sets a key-value pair identifier that will be included in all snapshots.
This identifier can be used to add the int
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 runs. Once the application is destroyed, user data is cleared.
Data can be removed via removeUserDataInt.
Method might throw Exception.
Implementation
static Future<void> setUserDataInt(
String key,
int? value,
) async {
try {
if (value == null) {
removeUserDataInt(key);
return;
}
final arguments = {"key": key, "value": value};
await channel.invokeMethod<void>('setUserDataLong', arguments);
} on PlatformException catch (e) {
throw Exception(e.details);
}
}