saveContact method
Implementation
Future<void> saveContact() async {
var phone = profile.mobileNumber.checkNull().isNotEmpty
? profile.mobileNumber.checkNull()
: getMobileNumberFromJid(profile.jid.checkNull());
var userName = profile.nickName.checkNull().isNotEmpty
? profile.nickName.checkNull()
: profile.name.checkNull();
if (phone.isNotEmpty) {
lib_phone_number.init();
var formatNumberSync = lib_phone_number.formatNumberSync(phone);
var parse = await lib_phone_number.parse(formatNumberSync);
debugPrint("parse-----> $parse");
Mirrorfly.addContact(parse["international"], userName).then((value) {
if (value ?? false) {
toToast(AppConstants.contactSaved);
if (!MirrorflyUikit.instance.isTrialLicenceKey) {
syncContacts();
}
}
});
} else {
mirrorFlyLog('mobile number', phone.toString());
}
}