setAttribute method

  1. @override
Future<bool> setAttribute({
  1. required String attributeKey,
  2. required dynamic attributeValue,
  3. required VWOContext vwoContext,
})
override

Sets a user attribute.

attributeKey The key of the attribute. attributeValue The value of the attribute. 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 String attributeKey,
  required dynamic attributeValue,
  required VWOContext vwoContext,
}) async {
  try {
    final result = await methodChannel.invokeMethod<bool>(
      'setAttribute',
      {
        'attributeKey': attributeKey,
        'attributeValue': attributeValue,
        'context': vwoContext.toMap(),
      },
    );
    return result ?? false;
  } on PlatformException catch (e) {
    // Handle errors from the native side
    throw Exception("Error: ${e.code}, ${e.message}");
  }
}