Skip to content

Commit

Permalink
Merge pull request #68 from shounakmulay/ISSUE-67
Browse files Browse the repository at this point in the history
Fix type cast for getSms methods. Changed to List? internally.
  • Loading branch information
shounakmulay authored Apr 2, 2021
2 parents 6262126 + 4807d4f commit d836482
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.1.2
* Change invokeMethod call type for getSms methods to List? (No change to telephony API)

## 0.1.1
* Added background instance for executing telephony methods in background.
* Fix type cast issues.
Expand Down
17 changes: 8 additions & 9 deletions lib/telephony.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:collection';
import 'dart:ui';

import 'package:flutter/services.dart';
Expand Down Expand Up @@ -174,8 +173,8 @@ class Telephony {
assert(_platform.isAndroid == true, "Can only be called on Android.");
final args = _getArguments(columns, filter, sortOrder);

final messages = await _foregroundChannel.invokeMethod<List<LinkedHashMap>>(
GET_ALL_INBOX_SMS, args);
final messages =
await _foregroundChannel.invokeMethod<List?>(GET_ALL_INBOX_SMS, args);

return messages
?.map((message) => SmsMessage.fromMap(message, columns))
Expand Down Expand Up @@ -204,8 +203,8 @@ class Telephony {
assert(_platform.isAndroid == true, "Can only be called on Android.");
final args = _getArguments(columns, filter, sortOrder);

final messages = await _foregroundChannel.invokeMethod<List<LinkedHashMap>>(
GET_ALL_SENT_SMS, args);
final messages =
await _foregroundChannel.invokeMethod<List?>(GET_ALL_SENT_SMS, args);

return messages
?.map((message) => SmsMessage.fromMap(message, columns))
Expand Down Expand Up @@ -234,8 +233,8 @@ class Telephony {
assert(_platform.isAndroid == true, "Can only be called on Android.");
final args = _getArguments(columns, filter, sortOrder);

final messages = await _foregroundChannel.invokeMethod<List<LinkedHashMap>>(
GET_ALL_DRAFT_SMS, args);
final messages =
await _foregroundChannel.invokeMethod<List?>(GET_ALL_DRAFT_SMS, args);

return messages
?.map((message) => SmsMessage.fromMap(message, columns))
Expand All @@ -261,8 +260,8 @@ class Telephony {
assert(_platform.isAndroid == true, "Can only be called on Android.");
final args = _getArguments(DEFAULT_CONVERSATION_COLUMNS, filter, sortOrder);

final conversations = await _foregroundChannel
.invokeMethod<List<LinkedHashMap>>(GET_ALL_CONVERSATIONS, args);
final conversations = await _foregroundChannel.invokeMethod<List?>(
GET_ALL_CONVERSATIONS, args);

return conversations
?.map((conversation) => SmsConversation.fromMap(conversation))
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: telephony
description: A Flutter plugin to use telephony features such as fetch network
info, start phone calls, send and receive SMS, and listen for incoming SMS.
version: 0.1.1
version: 0.1.2
homepage: https://github.com/shounakmulay/Telephony
repository: https://github.com/shounakmulay/Telephony

Expand Down

0 comments on commit d836482

Please sign in to comment.