fl_smart_http_secure library
fl_smart_http — Secure entry point.
Use this import instead of fl_smart_http.dart when you want
encryption-aware helpers to be available. Both entry points export
the full public API; this file additionally re-exports
CacheEncryptor, CacheDecryptionException, and EncryptionResult
at the top level for convenience.
Encryption is handled via pointycastle which is bundled with the package.
Setup (encrypted cache)
import 'package:fl_smart_http/fl_smart_http_secure.dart';
await FlSmartHttp.init(
baseUrl: 'https://api.example.com',
config: FlHttpConfig(
enableEncryption: true,
encryptionKey: 'your-32-character-secret-key!!!!',
),
);
Classes
- AuthRefreshInterceptor
- Automatically refreshes an expired auth token and retries the original request — transparently, without any changes at call sites.
- CacheEncryptor
- AES-256-GCM with PBKDF2-HMAC-SHA256 key derivation.
- CacheEntry
- A single cache record stored in Hive.
- CancellationToken
- A token that can cancel one or more in-flight/pending requests.
- ConnectivityMonitor
- Tracks real-time device connectivity.
- EncryptionResult
- Result of AES-256-GCM encryption.
- FlCacheStore
- Hive-backed persistent cache with LRU eviction.
- FlHttpConfig
- Global configuration for FlSmartHttp.
-
FlResponse<
T> - The unified, type-safe response returned by every FlSmartHttp call.
- FlSmartHttp
- A production-grade Flutter HTTP client with encrypted caching, interceptors, request queue, offline support, retry with exponential back-off, and full DI compatibility.
- HttpInterceptor
- Abstract base class for fl_smart_http interceptors.
- IFlSmartHttp
- Abstract interface for FlSmartHttp.
- LoggingInterceptor
- Pretty-print interceptor that logs every request and response.
- ModelRegistry
- Global registry mapping runtime types to their JSON factory functions.
-
QueuedRequest<
T> - Wraps a single HTTP request and its metadata for the request queue.
- QueueStatus
- Snapshot of the queue at a given moment.
- RateLimiter
- Enforces per-second and per-minute request rate limits.
- RequestContext
- Context passed to interceptors for a request.
- RequestQueue
- Manages queued HTTP requests with priority ordering, concurrency limits, cancellation support, and optional persistence.
- ResponseContext
- Context passed to interceptors for a response.
Enums
- CacheStrategy
- The caching strategy applied per request (or globally as default).
- DataSource
- Where the response data came from.
- FlLogLevel
- Log verbosity levels.
- QueuedRequestStatus
- Internal status of a queued request.
- RequestPriority
- Priority levels for queued requests.
Typedefs
-
FromJson<
T> = T Function(dynamic json) -
A type alias for a function that constructs
Tfrom decoded JSON.
Exceptions / Errors
- CacheDecryptionException
- Exception thrown when cache decryption fails.
- QueueFullException
- Exception thrown when the request queue is full.
- RequestCancelledException
- Exception thrown when a request is cancelled via CancellationToken.