linkloom
Connectivity-aware HTTP client for Flutter that never silently drops a request, plus a zero-config offline/online banner β in one package.
Most apps need two separate packages (connectivity_plus + some retry
logic you hand-roll) to handle this correctly. linkloom combines both:
- π‘ Auto offline queue β requests made while offline (or that fail) are persisted to disk and retried automatically with exponential backoff as soon as the connection returns β survives app restarts.
- π¨ Zero-config UI banner β wrap your app once, get an animated
"You're offline" / "Back online" banner with no manual
StreamBuilder. - π§© Drop-in replacement for basic
httpGET/POST/PUT/PATCH/DELETE calls.
Built with courier/delivery and field-work apps in mind β where drivers lose signal mid-route and you can't afford to lose an order update.
Install
dependencies:
linkloom: ^0.1.0
Usage
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await NetPulse.init(); // one-time setup, call before runApp
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: NetPulseBanner( // <- automatic offline banner
child: const HomePage(),
),
);
}
}
Making a request:
final client = NetPulseClient();
final result = await client.post(
'https://example.com/api/orders',
headers: {'Content-Type': 'application/json'},
body: '{"orderId": 123}',
);
if (result.queued) {
// Device was offline (or the request failed) β it's safely
// queued on disk and will retry automatically.
print('Queued. Pending: ${NetPulse.pendingCount}');
} else if (result.isSuccess) {
print('Sent! ${result.statusCode}');
} else {
print('Failed: ${result.error}');
}
API overview
| Symbol | Purpose |
|---|---|
NetPulse.init() |
One-time setup β call before runApp. |
NetPulse.isOnline |
Current connectivity state. |
NetPulse.pendingCount |
Number of requests waiting to retry. |
NetPulse.onConnectivityChange |
Stream of bool connectivity changes. |
NetPulseClient |
HTTP client with .get/.post/.put/.patch/.delete. |
NetPulseBanner |
Widget β wrap any screen for an automatic status banner. |
Customizing the banner
NetPulseBanner(
offlineMessage: "No internet connection",
backOnlineMessage: "Connected",
offlineColor: Colors.red,
backOnlineColor: Colors.green,
child: const HomePage(),
)
Contributing
Issues and PRs welcome β see CONTRIBUTING.md.
License
MIT β see LICENSE.
Libraries
- linkloom
- linkloom β connectivity-aware HTTP with automatic offline retry queueing, plus a zero-config online/offline UI banner.