ff 0.1.0
ff: ^0.1.0 copied to clipboard
fully fledged, frickin' fast flutter-framework
FF #
Finally, a fully fledged, frickin' fast Flutter framework!
Forever free. Fantastically fabulous. Feature-first.
Features #
- Feature-focused architecture — FF facilitates a feature-first folder structure for Flutter apps
- Frictionless state management — Forget about boilerplate, FF fabricates state files for you
- Fine-grained reactivity — FF furnishes field-level watching, so frames refresh only for fields that flip
- Flexible feature flavors — From
FFReusableFeaturetoFFSimpleFeature, find the fit for your flow
Foundations: First-Time Setup #
1. Fetch the FF Package #
First, furnish your pubspec.yaml file with the ff framework:
dependencies:
ff:
git:
url: "https://github.com/HannesGitH/ff"
2. Fasten the ffeature Brick #
FF features a Mason brick for fast feature scaffolding. First, form a mason.yaml file (if absent) and fill it with the following:
bricks:
ffeature:
git:
url: "https://github.com/HannesGitH/ff"
path: bricks/ffeature
3. Fire Up the FF State Watcher #
FF's file watcher fabricates state files for you. For VS Code folks, furnish your .vscode/tasks.json file with:
{
"version": "2.0.0",
"tasks": [
{
"label": "Start ff generation",
"type": "shell",
"command": "nix run github:HannesGitH/ff -- --directory .",
"presentation": {
"reveal": "never",
"panel": "new"
},
"isBackground": true,
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
For folks favoring manual firing, just flash this in your terminal:
nix run github:HannesGitH/ff -- --directory .
Forging Features #
Fabricate a Fresh Feature #
Following the setup, fashioning a feature is frighteningly fast. Fire off Mason:
mason make ffeature --name YourFeatureName
FF forges the following folder formation:
your_feature_name/
├── controller.dart # Feature controller for business flow
├── feature.dart # Feature entry points and factory functions
├── model.dart # ViewModel for formatting state for the frontend
├── state.dart # State definition (ff-state flagged)
├── types.dart # Type definitions for the feature
├── views/
│ └── main.dart # Primary view for the feature
└── widgets/
└── example.dart # Fragment widgets for the feature
Flag Your State for Generation #
For FF to fabricate state files, flag your state class with the ff-state token:
import 'package:ff/ff.dart';
import 'package:flutter/widgets.dart';
part 'state.ff.dart';
// ff-state
class $YourFeatureState {
const $YourFeatureState({
required String firstName,
required bool favoriteSelected,
});
static YourFeatureState initial() =>
YourFeatureState.loading(firstName: '', favoriteSelected: false);
}
FF finds files flagged with ff-state and forges a *.state.ff.dart file featuring:
YourFeatureState— Full state class with field metadataYourFeatureStateWatched— For fine-grained field-level reactivityYourFeatureStateUnwatched— For fast, full-state access- Feature typedefs for
FFWidget,FFView,FFPresenter, and more
Fundamentals: How FF Functions #
Feature Architecture #
FF follows a feature-first philosophy. Features form self-contained folders featuring:
- State — Fields forming the feature's data
- Controller — Functions for feature flow and firing state changes
- ViewModel — Formats state for frontend friendliness
- Views — Flutter widgets forming the feature's face
Fine-Grained Field Watching #
FF's foremost forte is fine-grained field-level watching. Features function as follows:
- Fields in state are flagged with
FFPropWithMetadata, furnishing both value and loading flags - Views fetch fields via the watched state (
state.watched(context).fieldName) - FF's
InheritedModelframework filters rebuilds — only widgets fetching a flipped field refresh - Fields flagged as "loading" furnish shimmer functionality for free
FF State Watcher (Filesystem Watcher) #
FF features a Rust-forged filesystem watcher for fabricating state files:
- File Monitoring — Faithfully follows
.dartfiles for fluctuations - Flag Finding — Finds the
ff-stateflag in file contents - Fabrication — Forges
*.ff.dartfiles from Handlebars templates - Fast Feedback — File changes fire fresh generation in a flash
Feature Flavors #
FF furnishes four feature flavors for flexibility:
| Flavor | Function |
|---|---|
FFReusableFeature |
For features with one controller, forever reused |
FFReusableMultiFeature |
For features with controllers filed by parameter (e.g., userId) |
FFSimpleFeature |
For features forging fresh controllers for each entry |
FFFeature |
Foundation interface for all feature flavors |
File Flow: From State to Screen #
┌─────────────────┐
│ state.dart │ ← Flag with ff-state
│ $FeatureState │
└────────┬────────┘
│ FF fabricates
▼
┌─────────────────┐
│ state.ff.dart │ ← Full state with watching
│ FeatureState │
└────────┬────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐
│ Controller │ ←─► │ ViewModel │
│ emit(state) │ │ formats fields │
└────────┬────────┘ └────────┬────────┘
│ │
└───────────┬───────────┘
▼
┌─────────────────────────────────┐
│ FFView │
│ view.state.fieldName │
│ (fine-grained field watching) │
└─────────────────────────────────┘
Frequently Found Fixes #
FF State File Fails to Form? #
- First, verify the
ff-stateflag features in your file - Firmly check the ff-watcher is functioning (
nix run github:HannesGitH/ff -- --directory .) - Fret not about formatting — fix syntax, and FF will forge fresh files
Fields Failing to Fire Rebuilds? #
- Fetch fields from
view.state(the watched flavor), notcontroller.state - Forgetting
view.state.fieldNamemeans Flutter fails to flag field dependencies
Further Findings #
- Forever Free — FF follows the MIT license
- Feedback Favored — File issues for feature requests or fixes
- Future Features — FF is flourishing fast, follow for forthcoming functionality
Fashioned with fervor for Flutter fanatics. 🦋