Excellent โ hereโs a professional, full-length README.md for your new package flutter_dtmf_pro, written in the style of a seasoned Flutter plugin engineer.
This version highlights your modernizations (Gradle, Kotlin, Web), includes working examples, platform notes, and installation instructions.
# flutter_dtmf_pro
[](https://pub.dev/packages/flutter_dtmf_pro)
[](https://flutter.dev)
[](LICENSE)
> A modernized Flutter plugin for generating **DTMF (Dual-Tone Multi-Frequency)** tones across Android, iOS, and Web platforms.
> Useful for **VoIP**, **dialer**, **telephony**, or **tone-based signaling** applications.
---
## โจ Features
- ๐ต Generate DTMF tones from any string of digits (`0โ9`, `AโD`, `*`, `#`)
- โ๏ธ Configurable tone **duration**, **volume**, and **sampling rate**
- ๐ฑ Native Android implementation via [`ToneGenerator`](https://developer.android.com/reference/android/media/ToneGenerator)
- ๐ Web-compatible implementation using the Web Audio API (`package:web`)
- ๐งฉ Compatible with **Flutter 3.24+**, **Kotlin 1.9+**, and **Gradle 9.1+**
- ๐งฑ Clean architecture & null-safety support
---
## ๐ Installation
Add the dependency in your projectโs `pubspec.yaml`:
```yaml
dependencies:
flutter_dtmf_pro: ^1.0.0
Then run:
flutter pub get
Import it in your Dart code:
import 'package:flutter_dtmf_pro/flutter_dtmf_pro.dart';
๐ง Usage Examples
Play multiple tones in sequence:
await Dtmf.playTone(
digits: "1234567890ABCD*#",
durationMs: 500, // duration per tone (milliseconds)
volume: 0.8, // 0.0 to 1.0
);
Play a single tone with a custom sampling rate:
await Dtmf.playTone(
digits: "1",
samplingRate: 80000.0, // custom tone precision
);
Stop playing (if applicable on platform):
await Dtmf.stopTone();
๐งฉ Platform Support
| Platform | Status | Implementation |
|---|---|---|
| Android | โ | Uses ToneGenerator API |
| iOS | โ๏ธ Planned | Native audio implementation in progress |
| Web | โ | Uses Web Audio API via package:web |
| macOS / Windows / Linux | โ๏ธ Planned | Cross-platform tone synthesis under consideration |
โ๏ธ Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
digits |
String |
โ | DTMF sequence to play (0โ9, AโD, *, #) |
durationMs |
int |
160 | Duration of each tone in milliseconds |
volume |
double |
1.0 | Volume of playback (0.0โ1.0) |
samplingRate |
double |
44100.0 | Sampling rate for audio generation |
forceMaxVolume |
bool |
false | Forces tone playback at max volume (Android only) |
ignoreDtmfSystemSettings |
bool |
false | Bypasses system DTMF controls (Android only) |
๐ฆ Example App
A complete Flutter example is included in /example.
Run it with:
cd example
flutter run
This demonstrates tone generation for all supported characters.
๐งฑ Android Notes
- Uses
android.media.ToneGenerator - Requires
android.permission.MODIFY_AUDIO_SETTINGSinAndroidManifest.xml(automatically handled in most cases) - Compatible with
minSdkVersion 21andcompileSdkVersion 34
๐ Web Notes
-
Uses
AudioContextfrom the Web Audio API -
Requires the
webdependency:dependencies: web: ^1.0.0 -
Supported on Chrome, Edge, and Safari.
๐งพ Changelog
See CHANGELOG.md for the complete release history.
๐งโ๐ป Contributing
Contributions, pull requests, and issue reports are welcome!
Please ensure changes pass dart analyze and flutter test before submission.
๐ License
MIT License ยฉ 2025 Redemption Gwira
๐ฎ Roadmap
xAndroid implementation viaToneGeneratorxWeb implementation viapackage:webiOS native tone generationWindows / Linux supportContinuous tone stream API
Made with โค๏ธ in Flutter โ bringing clear, crisp tones to your apps.
---
Would you like me to generate a **shortened pub.dev description block** (under 200 characters, ideal for `pubspec.yaml`) based on this README? That ensures it looks perfect on the pub.dev listing page.