ussd 0.0.2+1 ussd: ^0.0.2+1 copied to clipboard
Run ussd code directly in your application.
ussd #
Run ussd code directly in your application
Getting Started #
On Android you'll need to add either the ACCESS_CALL_PHONE
permission to your Android Manifest. To do so open the AndroidManifest.xml file (located under android/app/src/main) and add one of the following one line as direct children of the <manifest>
tag:
<uses-permission android:name="android.permission.CALL_PHONE"/>
main.dart #
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:ussd/ussd.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
Future<void> launchUssd(String ussdCode) async {
Ussd.runUssd(ussdCode);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Run ussd code plugin by mandreshope'),
),
body: Center(
child: Column(
children: <Widget>[
RaisedButton(
onPressed: () {
launchUssd("#123#");
},
child: Text("Tap to run ussd Orange Mg operator"),
),
RaisedButton(
onPressed: () {
launchUssd("*999#");
},
child: Text("Tap to run ussd Airtel Mg operator"),
),
],
)
),
),
);
}
}