All bites
The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.
4247 bites
Page 11
shared_preferences for Simple On-Device Storage
shared_preferences is Flutter's go-to for simple on-device key-value storage, like a persistent dictionary for user settings. Use it to save a dark mode toggle or high score. Crucially, writes are not guaranteed, so don't use it for critical data.
path_provider: Find Platform-Specific File Paths
path_provider asks the OS for standard file paths instead of you guessing. Use it to find the correct documents, temp, or cache directories on any platform. The footgun: not all paths exist on all systems, so always check for null returns.
Reading and Writing Files in Dart
Treat files as either a single string for simple cases or a stream of data for large ones. Use dart:io for saving user settings or processing logs. The main footgun is using synchronous methods like readAsStringSync, which can freeze your app.
sqflite: Local SQL Databases in Flutter
sqflite gives your Flutter app a private, on-device SQL database by wrapping the native SQLite engine. Use it for storing structured local data, like to-do lists or settings. The footgun: all database operations are async, so you must await every call.
Hive: A Fast, Local Key-Value Store for Dart
Hive is a lightweight key-value database for Dart, acting like a persistent, super-fast Map. Use it to store simple data like user settings or cache API responses locally.
flutter_secure_storage: Secure Key-Value Pairs
flutter_secure_storage is your go-to for saving sensitive data like API tokens. Think of it as an encrypted, cross-platform key-value store that uses native Keychain on iOS and strong ciphers on Android. The footgun: it's slower and meant only for secrets.
Drift Schema Migrations: Evolving Your Database Safely
Think of schema migrations as a recipe for upgrading your app's database from an old version to a new one. You'll use them whenever you add a table or column in Drift. The footgun is forgetting to bump schemaVersion; your migration won't run.

Drift: Type-Safe SQL in Dart & Flutter
Drift gives your raw SQL queries compile-time safety. Instead of parsing maps, its build-time analyzer validates your SQL and generates typed Dart objects for results. Use it to write complex queries without risking runtime errors from typos or schema changes.
Isar: A Modern NoSQL Database for Flutter Apps
Isar is a fast, local NoSQL database for Flutter, offering static typing and ACID guarantees. Use it for on-device persistence in iOS, Android, and desktop apps. Don't mistake it for a remote database; Isar is for local storage, not cloud sync.
Full-Text Search in Local Flutter Databases
SQLite FTS5 is an inverted index in your app: words map to row IDs, skipping brute-force scans. Use it when local tables exceed thousands of rows and LIKE lags. The footgun is that FTS virtual tables never auto-sync, so stale indexes return wrong rows.
AnimatedContainer: Simple UI Animations Without Controllers
AnimatedContainer is a 'fire-and-forget' animation widget. It automatically animates its own properties like size and color when they change. Use it for simple UI state changes, like a button that grows when tapped. It only animates itself, not its child.
TweenAnimationBuilder: Animate Anything Implicitly
TweenAnimationBuilder animates any widget property without a complex AnimationController. Just give it a target value, duration, and curve. Use it for one-off animations where a full controller is overkill.
CurvedAnimation: Animate with Easing and Personality
CurvedAnimation makes animations feel natural by applying a timing curve to another animation. Instead of linear motion, widgets can ease-in or bounce. Footgun: Elastic curves can overshoot the standard 0.0-1.0 range, causing unexpected UI behavior.
AnimationController: The Conductor of Your Animation
An AnimationController is the conductor for your animation's timing. It produces values from 0.0 to 1.0 over a duration, letting you play, reverse, or stop animations. Use it to drive widgets like SlideTransition.
Flutter's Tween: The Recipe for Animation
A Tween is a recipe for animation, not the animation itself. It maps a 0.0-1.0 progress value to a concrete value, like a color or position. Use it with an AnimationController to smoothly transition a widget's properties.
AnimatedBuilder: Isolate Animation Rebuilds for Performance
Flutter's AnimatedBuilder rebuilds only the widgets that change during an animation, not the entire screen. Use it to embed a moving part within a larger static widget, like a spinning icon on a button, to maximize performance.
CustomPaint: Drawing Your Own Widgets in Flutter
CustomPaint is your blank canvas widget; CustomPainter is the artist that draws on it. Use them for custom charts or unique UI. The footgun: shared canvases can cause blend modes to erase other widgets, so use saveLayer sparingly.
ClipPath: Clip Widgets to Custom Shapes
ClipPath is a stencil for your widgets. It cuts a child widget to a custom-defined shape, hiding anything outside the lines. Use it for complex shapes like waves or stars, but avoid it for simple rectangles or circles—it's expensive.
Staggered Animations: Choreographing UI Changes
A staggered animation is a domino effect for your UI. Instead of animating everything at once, you sequence animations with slight delays for a more fluid, polished feel. Use it for list items appearing one by one. The footgun is timing: too long feels slow.
Flutter's Path Class: Drawing Custom Shapes
Flutter's Path is a digital pen for drawing any custom shape. Use it for complex icons, charts, or clipping widgets into non-rectangular forms. The footgun: forgetting moveTo will connect separate parts of your drawing with an unwanted line.