auto_save_controller 1.0.0 copy "auto_save_controller: ^1.0.0" to clipboard
auto_save_controller: ^1.0.0 copied to clipboard

A Flutter TextEditingController that automatically saves and loads local text drafts with built-in debounce, TTL expiry, and AppLifecycle awareness.

Changelog #

All notable changes to auto_save_controller will be documented in this file.

1.0.0 #

Initial release.

Features #

  • AutoSaveTextEditingController — a drop-in TextEditingController replacement that automatically persists and restores text drafts.
  • AutoSaveController typedef — a concise alias for AutoSaveTextEditingController to reduce boilerplate in consuming code.
  • Debounce — configurable debounceDuration (default 500 ms) prevents excessive write operations during active typing.
  • TTL (Time-To-Live) — optional maxDraftAge automatically expires and deletes stale drafts on load.
  • AppLifecycle awareness — pending debounce timers are flushed immediately when the app becomes inactive, paused, or detached, preventing draft loss.
  • Storage-agnostic design — the AutoSaveStorage abstract interface decouples the controller from any specific storage backend; bring your own implementation.
  • Global configurationAutoSave.init(storage:) registers a single-instance fallback storage used by all controllers that do not provide their own storage argument.
  • Per-controller injection — pass a storage argument directly to the constructor to override the global instance on a per-controller basis.
  • Length guardmaxDraftLength (default 10 000 chars) silently skips saves for oversized drafts without deleting previously saved content.
  • Empty-text guard — saving an empty text field deletes the stored draft, keeping storage clean.
  • Priority controlprioritizeDraftOverInitial governs whether a restored draft overwrites an explicitly provided initial text value.
  • clearDraft() — programmatically deletes the persisted draft and resets the text field in one call.
  • Zero third-party dependencies — only the Flutter SDK is required.
0
likes
160
points
30
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter TextEditingController that automatically saves and loads local text drafts with built-in debounce, TTL expiry, and AppLifecycle awareness.

Repository (GitHub)
View/report issues

Topics

#text-editing #autosave #draft #form #storage

License

MIT (license)

Dependencies

flutter

More

Packages that depend on auto_save_controller