addContact static method
This method adds a contact with the specified phone number and name to the user's contact list. It is an asynchronous operation that returns a Future<bool?> indicating the success or failure of the contact addition.
Parameters:
number
- The phone number of the contact to be added.
name
- The name of the contact to be added.
Returns:
A Future<bool?> that completes with true
if the contact was successfully added,
false
if the operation failed, or null
if an error occurred.
Example usage:
bool? isSuccess = await Mirrorfly.addContact(
number: "1234567890",
name: "John Doe",
);
if (isSuccess == true) {
print("Contact added successfully");
} else {
print("Failed to add contact");
}
Implementation
static Future<bool?> addContact(
{required String number, required String name}) async {
return FlyChatFlutterPlatform.instance.addContact(number, name);
}