network_pulse
Universal Flutter HTTP & Dio network monitoring, in-app debug inspector, and automated Telegram error alert dispatcher with zero-leak token security.
🌟 Features
- 🌐 Universal Networking Support: Works seamlessly with Dio, http, Retrofit, GetConnect, and Chopper.
- 📱 In-App Floating Inspector Overlay: Non-intrusive debug bubble displaying real-time HTTP calls, status codes, latency, formatted JSON, and 1-tap cURL export.
- 🚨 Automated Telegram Alerts: Instantly sends markdown error reports to your Telegram Bot/Group on
5xx Server Errors,4xx Client Errors, orTimeouts. - 🔒 Zero Token Leaks (
.gitignoreProtected): Read secrets via.envfiles or generated configs without committing sensitive bot tokens to Git version control.
🚀 Quick Start
1. Installation
Add network_pulse to your pubspec.yaml:
dependencies:
network_pulse: ^0.0.1
2. Initialization
Initialize NetworkPulse in your main.dart:
void main() {
NetworkPulse.init(
telegramBotToken: const String.fromEnvironment('TELEGRAM_BOT_TOKEN'),
telegramChatId: const String.fromEnvironment('TELEGRAM_CHAT_ID'),
notifyOn5xx: true,
notifyOnTimeouts: true,
ignoredPaths: ['/ping', '/health'],
);
runApp(
const NetworkPulseOverlay(
child: MyApp(),
),
);
}
3. Attach Interceptors
For Dio / Retrofit:
final dio = Dio();
dio.interceptors.add(NetworkPulse.dioInterceptor());
For package:http:
final client = NetworkPulse.httpClient();
final response = await client.get(Uri.parse('https://api.example.com/data'));
🔒 Security Best Practices
To prevent committing sensitive Telegram Bot Tokens and Chat IDs to GitHub:
- Store credentials in a
.envfile or pass via--dart-define:flutter run --dart-define=TELEGRAM_BOT_TOKEN="YOUR_BOT_TOKEN" --dart-define=TELEGRAM_CHAT_ID="-1001234567890" - Always add
.envand.g.dartto your.gitignore:# NetworkPulse Secrets .env *.g.dart
📄 License
MIT License. Created & maintained by Ibrohim Qobilov.