setAttribute method
Future<bool>
setAttribute({
- required Map<
String, dynamic> attributes, - required VWOContext userContext,
override
Sets a user attribute.
attributes
The map of the attributes.
context The user context for the attribute.
Returns a Future that resolves to a boolean indicating the success status of setting the attribute.
Implementation
@override
Future<bool> setAttribute(
{required Map<String, dynamic> attributes,
required VWOContext userContext}) async {
try {
final Map<String, dynamic> arguments = {
'attributes': attributes,
'context': userContext.toMap(),
};
final result =
await methodChannel.invokeMethod<bool>('setAttribute', arguments);
return result ?? false;
} on PlatformException catch (e) {
// Handle errors from the native side
throw Exception("Error: ${e.code}, ${e.message}");
}
}