createContact method

  1. @override
Future<Contact> createContact(
  1. Contact contact
)
override

Creates a new contact.

contact - The contact data to create.

Implementation

@override
Future<Contact> createContact(Contact contact) async {
  try {
    final result = await methodChannel.invokeMethod<dynamic>(
      'createContact',
      contact.toJson(),
    );

    return Contact.fromJson(_safeMapCast(result));
  } on PlatformException catch (e) {
    throw Exception('Failed to create contact: ${e.message}');
  }
}