get_phone_number 3.0.10 get_phone_number: ^3.0.10 copied to clipboard
Get real phone number from device - It only works on android device and also need to run in a real device.
get_phone_number #
Get Phone Number from Android Native
Warning: This library works in only android.
Usage #
Simple function
String phoneNumber = await GetPhoneNumber().get();
print('getPhoneNumber result: $phoneNumber');
List of phone number
List<String> list = await GetPhoneNumber().getListPhoneNumber();
print('getListPhoneNumber result: list');
Detailed function with android permissions
final module = GetPhoneNumber();
if (!module.isSupport()) {
print('Not supported platform');
}
if (!await module.hasPermission()) {
if (!await module.requestPermission()) {
throw 'Failed to get permission phone number';
}
}
String phoneNumber = await module.getPhoneNumber();
print('getPhoneNumber result: $phoneNumber');