Ussd plugin for Flutter

This plugin makes it possible to access Android's sendUssdRequest method from a Flutter application.

Installation

Add ussd_service as a dependency in your pubspec.yaml.

Make sure that your AndroidManifext.xml file includes the following permission:

<uses-permission android:name="android.permission.CALL_PHONE" />

Usage

Before you use this plugin, you must:

You may then use the plugin:

import 'package:ussd_service/ussd_service.dart';

makeMyRequest() async {
  int subscriptionId = 1; // sim card subscription ID
  String code = "*21#"; // ussd code payload
  try {
    String ussdResponseMessage = await UssdService.makeRequest(subscriptionId, code);
    print("succes! message: $ussdResponseMessage");
  } catch(e) {
    debugPrint("error! code: ${e.code} - message: ${e.message}");
  }
};

makeMyRequest();

Libraries

ussd_service