format method
Format phoneNumberString
or regionCode
Return formatted phone number
Throws PlatformException if phoneNumberString
is invalid
Implementation
Future<String> format(
String phoneNumberString,
String regionCode,
) async {
final result = await _channel.invokeMapMethod<String, dynamic>(
'format',
{
'string': phoneNumberString,
'region': regionCode,
},
);
if (result == null) {
throw PlatformException(
code: 'FORMAT_FAILED',
message: 'Formatting the phone number returned null',
);
}
return result['formatted'];
}