flutter_fahhh_core 0.0.1
flutter_fahhh_core: ^0.0.1 copied to clipboard
Core architectural primitives designed to accelerate robust Flutter app scaffolding, including network helpers, explicit failures, and base architecture components.
Flutter Fahhh Core #
Core architectural primitives designed to accelerate robust Flutter app scaffolding, including network helpers, explicit failures, and UI extensions.
This package serves as the baseline architectural foundation behind the flutter_fahh_archi CLI.
Installation #
Add this to your pubspec.yaml:
dependencies:
flutter_fahhh_core: ^0.0.1
Features #
This package provides generic wrappers and classes that enforce a consistent clean architecture format.
Functional Error Handling (Result) #
Say goodbye to confusing try-catch blocks and explicit null checking. This package implements a Result<Data, Failure> class to make success/failure flows explicit and safe:
Result<User, Failure> fetchUser() {
if (success) {
return const Result.success(User(name: "Flutter Architect"));
} else {
return const Result.failure(ServerFailure("Server is down"));
}
}
Typed Failure #
Instead of raw exceptions, we implement sealed robust Failure types that map flawlessly to front-end states: ServerFailure, CacheFailure, and NetworkFailure.
UseCase Pattern #
Provides an abstract UseCase<Type, Params> to enforce clean domain-driven logic.
class GetUserUseCase implements UseCase<User, NoParams> {
@override
Future<Result<User, Failure>> call(NoParams params) async {
return await userRepository.getUser();
}
}
Generic API Manager (dio) #
A pre-configured ApiClient using dio that automatically applies standard 30-second timeouts, intercepts headers, logs HTTP bodies natively via PrettyLogs, and handles raw Dio exceptions safely.
UI Context Extensions #
Dramatically shorten widget markup with BuildContext extensions:
// Native
Theme.of(context).primaryColor
// With `flutter_fahhh_core`:
context.theme.primaryColor
context.textTheme.headlineMedium
context.colorScheme.surface
context.screenSize
context.showSnackBar("Hello World", isError: false);
ResponsiveBuilder #
An intuitive wrapper that conditionally builds layouts depending on width constraints (mobile, tablet, desktop).
Purpose #
While you can use this manually, its real power is when utilized alongside the code generation capabilities of the Flutter Fahhh Architect CLI!
Support this Project #
If you find this useful, consider buying me a coffee! Your support helps me keep building awesome open-source tools.