sendMessageInSession method

  1. @override
Future<Map<String, dynamic>> sendMessageInSession(
  1. String message
)
override

Sends a message in the active multi-session USSD session

message - The message to send

Returns a map with the operation result. Only works if there is an active multi-session session.

Implementation

@override
Future<Map<String, dynamic>> sendMessageInSession(String message) async {
  try {
    final result = await methodChannel.invokeMethod<Map<Object?, Object?>>(
      'sendMessageInSession',
      {'message': message},
    );
    return Map<String, dynamic>.from(result ?? {});
  } on PlatformException catch (e) {
    debugPrint('Error sending message in session: ${e.message}');
    return {'success': false, 'error': e.message};
  }
}