app_alerts 0.1.0
app_alerts: ^0.1.0 copied to clipboard
App-wide, prioritized alert delivery for Flutter. Polls (or receives pushed) alerts from a configurable backend source, tracks what has already been presented, and shows urgent pop-up alerts above eve [...]
0.1.0 #
Initial release.
Alert/AlertFeed— the JSON wire contract, with tolerant parsing (malformed rows are skipped, unknown alert types fall back to inline).AlertSourceabstraction withHttpAlertSource(poll a JSON document, e.g. on NetStorage/CDN),WebSocketAlertSource(push with auto-reconnect and optional HTTP cold-start sync), andSampleAlertSource(useSampleData: true).AlertsController— polling + push merge, expiry filtering, presented-alert deduplication, and backend-priority ordering; urgent alerts published one at a time, inline alerts as a sorted listenable list.AlertHistoryStorewith in-memory default andDelegatingAlertHistoryStorefor app-owned persistence, keeping the package plugin-free.AppAlertsfacade withAppAlerts.builderfor one-line, app-wide urgent pop-ups above every route; configurable dismiss-lock duration (default 2 s) during which only the OK button dismisses.InlineAlertsBuilderfor host-styled inline alerts.- Alert URLs: optional
url(+goLabel) contract fields for deep links or external sites, routed through the app-suppliedonOpenUrlhandler. URL-carrying urgent alerts show a Go/Dismiss button pair; inline consumers receivealert.urland can reuse the handler viaAlertsController.openUrl. urgentAlertBuilderescape hatch to replace the built-in pop-up with a fully custom, app-themed presentation while keeping scheduling, dedupe, and app-inerting in the package.- Full accessibility: screen-reader announcements, semantic modal route, focus containment, keyboard operation, 48 px touch targets.
- Race-hardened by design: id-scoped dismissal (a double-tap can never consume an unseen alert), synchronous state transitions decoupled from history-store I/O, re-entrancy-safe polling, and start-up that survives a failing history store.
- Runs on all Flutter platforms including web and embedded — pure-Dart
dependencies only (
http,web_socket_channel), widget-layer-only UI.