setUserProperty method
Sets a user property to a given value.
Up to 25 user property names are supported. Once set, user property values persist throughout the app lifecycle and across sessions.
name
is the name of the user property to set. Should contain 1 to 24
alphanumeric characters or underscores and must start with an alphabetic
character. The "firebase_" prefix is reserved and should not be used for
user property names.
Implementation
Future<void> setUserProperty(
{@required String name, @required String value}) async {
if (name == null) {
throw ArgumentError.notNull('name');
}
if (name.isEmpty ||
name.length > 24 ||
name.indexOf(_alpha) != 0 ||
name.contains(_nonAlphaNumeric))
throw ArgumentError.value(
name, 'name', 'must contain 1 to 24 alphanumeric characters.');
if (name.startsWith('firebase_'))
throw ArgumentError.value(name, 'name', '"firebase_" prefix is reserved');
await _platformInstance.setUserProperty(name: name, value: value);
}