sendAttribute method
Sends an attribute with the specified attributeName and attributeValue.
This method invokes the native method sendAttribute.
Throws a PlatformException if the attribute sending fails.
attributeName: The name of the attribute to send.
attributeValue: The value of the attribute to send.
Implementation
Future<void> sendAttribute(
String attributeName, String attributeValue) async {
if(Platform.isAndroid){
try {
await methodChannel.invokeMethod('sendAttribute',
{"attributeName": attributeName, "attributeValue": attributeValue});
} on PlatformException catch (e) {
print("Failed to send attribute: '${e.message}'.");
}}
else if(Platform.isIOS){
try {
// Sending the attribute to the iOS side
await methodChannel.invokeMethod('sendAttribute', {
'attributeName': attributeName,
'attributeValue': attributeValue,
});
print("Attribute Sent: $attributeName = $attributeValue");
} on PlatformException catch (e) {
print("Failed to send attribute: '${e.message}'.");
}
}
}