initializedSMSStream method

  1. @override
Future<void> initializedSMSStream()
override

Implementation

@override
Future<void> initializedSMSStream() async {
  eventChannel.receiveBroadcastStream().listen((data) {
    if (data is Map) {
      final Map<String, String> smsData = {
        "sender": data["sender"] as String? ?? "",
        "body": data["body"] as String? ?? "",
      };
      _smsController.add(smsData);
    }
  }, onError: (error) {
    print("Error in receiving SMS event :$error");
  });
}