getSmsMessagesByPhoneNumber method
Get SMS messages by phone number
Implementation
@override
Future<List<SmsMessage>> getSmsMessagesByPhoneNumber(String phoneNumber) async {
try {
final List<dynamic> result = await methodChannel.invokeMethod<List<dynamic>>('getSmsMessagesByPhoneNumber', {
'phoneNumber': phoneNumber,
}) ?? [];
return result.map((item) => SmsMessage.fromMap(Map<String, dynamic>.from(item))).toList();
} on PlatformException catch (e) {
if (e.code == 'NOT_SUPPORTED') {
throw UnsupportedError('Reading SMS messages is not supported on this platform');
}
rethrow;
}
}