https://github.com/fathialamre/jet
π Jet - A production-ready Flutter framework with batteries included. Built on Riverpod 3, featuring type-safe networking, forms with 70+ validators, secure storage, theming, i18n, routing, and a rich component library. Accelerate development from prototype to production with best practices baked in.
https://github.com/fathialamre/jet
dart flutter forms framework localization mobile-development networking riverpod routing state-management themeing toolkit
Last synced: 3 months ago
JSON representation
π Jet - A production-ready Flutter framework with batteries included. Built on Riverpod 3, featuring type-safe networking, forms with 70+ validators, secure storage, theming, i18n, routing, and a rich component library. Accelerate development from prototype to production with best practices baked in.
- Host: GitHub
- URL: https://github.com/fathialamre/jet
- Owner: fathialamre
- Created: 2025-07-02T19:50:33.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-10-21T17:09:25.000Z (3 months ago)
- Last Synced: 2025-10-23T04:51:55.548Z (3 months ago)
- Topics: dart, flutter, forms, framework, localization, mobile-development, networking, riverpod, routing, state-management, themeing, toolkit
- Language: Dart
- Homepage:
- Size: 3.4 MB
- Stars: 7
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Security: docs/SECURITY.md
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
# π Jet Framework
**Jet** is a production-ready, lightweight Flutter framework designed for building scalable, maintainable applications with confidence. It provides a complete architectural foundation with best practices baked in, eliminating boilerplate and accelerating development from prototype to production.
Built on **Riverpod 3** with code generation support, Jet combines powerful state management, type-safe networking, secure storage, and a rich component libraryβall working seamlessly together.
## β¨ Why Jet?
- **π― Batteries Included** - Everything you need from day one: routing, networking, forms, storage, notifications, and more
- **π Opinionated Architecture** - Best practices and patterns built-in, no more architectural decisions paralysis
- **β‘ Developer Experience** - Hot reload friendly, minimal boilerplate, fluent APIs, and comprehensive documentation
- **π Production Ready** - Security features, error handling, logging, and performance optimizations out of the box
- **π Global Ready** - Built-in internationalization, RTL support, and adaptive UI components
- **π§© Modular Design** - Use what you need, extend with adapters, customize to fit your requirements
## π Table of Contents
- [Installation](#-installation)
- [Quick Start](#-quick-start)
- [Features](#-features)
- [Configuration](#οΈ-configuration)
- [Routing](#-routing)
- [Adapters](#-adapters)
- [Storage](#-storage)
- [Theming](#-theming)
- [Localization](#-localization)
- [Environment Configuration](#-environment-configuration)
- [Networking](#-networking)
- [Error Handling](#οΈ-error-handling)
- [Forms](#-forms)
- [Components](#-components)
- [Dialogs & Sheets](#-dialogs--sheets)
- [Extensions](#-extensions)
- [Security](#-security)
- [Sessions](#-sessions)
- [State Management](#-state-management)
- [Notifications](#-notifications)
- [Debugging](#-debugging)
- [Helpers](#-helpers)
- [Key Features Summary](#-key-features-summary)
- [Documentation](#-documentation)
- [Core Features](#core-features)
- [Advanced Features](#advanced-features)
- [Utilities](#utilities)
- [Additional Resources](#-additional-resources)
- [Contributing](#-contributing)
- [License](#-license)
## π¦ Installation
Add Jet to your Flutter project:
```yaml
dependencies:
jet:
path: packages/jet
```
## π Quick Start
Get up and running with Jet in 3 simple steps:
### 1. Create Your App Configuration
Create a configuration file at `lib/core/config/app_config.dart`:
```dart
import 'package:jet/jet.dart';
import 'package:flutter/material.dart';
class AppConfig extends JetConfig {
@override
List get adapters => [
RouterAdapter(),
StorageAdapter(),
NotificationsAdapter(),
];
@override
List get supportedLocales => [
LocaleInfo(
locale: const Locale('en'),
displayName: 'English',
nativeName: 'English',
),
];
@override
ThemeData? get theme => ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
useMaterial3: true,
);
}
```
### 2. Set Up Your Router
Create a router file at `lib/core/router/app_router.dart`:
```dart
import 'package:auto_route/auto_route.dart';
@AutoRouterConfig()
class AppRouter extends RootStackRouter {
@override
List get routes => [
AutoRoute(page: HomeRoute.page, path: '/', initial: true),
];
}
final appRouterProvider = AutoDisposeProvider((ref) {
return AppRouter();
});
```
### 3. Initialize in main.dart
```dart
import 'package:flutter/material.dart';
import 'package:jet/jet.dart';
import 'core/config/app_config.dart';
import 'core/router/app_router.dart';
void main() async {
final config = AppConfig();
Jet.fly(
setup: () => Boot.start(config),
setupFinished: (jet) {
jet.setRouter(appRouterProvider);
Boot.finished(jet, config);
},
);
}
```
**That's it!** π You now have a fully configured Jet app with routing, theming, localization, storage, and notifications ready to go.
## π Features
### βοΈ Configuration
Centralized app configuration with `JetConfig` for adapters, locales, themes, and network logging.
```dart
class AppConfig extends JetConfig {
@override
List get adapters => [RouterAdapter()];
@override
List get supportedLocales => [
LocaleInfo(locale: const Locale('en'), displayName: 'English', nativeName: 'English'),
];
}
```
π **[View Complete Documentation](docs/CONFIGURATION.md)**
---
### π§ Routing
Type-safe navigation with **[AutoRoute](https://pub.dev/packages/auto_route)** integration. AutoRoute provides code generation for type-safe routes, eliminating string-based navigation and providing compile-time safety.
```dart
// Navigate to a route
context.router.push(ProfileRoute());
// Navigate with parameters
context.router.push(ProfileRoute(userId: '123'));
```
π **[View Complete Documentation](docs/ROUTING.md)**
---
### π Adapters
Extend Jet with custom adapters for third-party services.
```dart
class FirebaseAdapter implements JetAdapter {
@override
Future boot(Jet jet) async {
await Firebase.initializeApp();
return jet;
}
}
```
π **[View Complete Documentation](docs/ADAPTERS.md)**
---
### πΎ Storage
Secure local storage for lightweight data using **[shared_preferences](https://pub.dev/packages/shared_preferences)** for regular data and **[flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage)** for encrypted sensitive data (tokens, passwords).
```dart
// Regular storage
await JetStorage.write('user_name', 'John Doe');
String? name = JetStorage.read('user_name');
// Secure storage (encrypted)
await JetStorage.writeSecure('auth_token', 'your-jwt-token');
String? token = await JetStorage.readSecure('auth_token');
```
π **[View Complete Documentation](docs/STORAGE.md)**
---
### π¨ Theming
Built-in theme management with persistent storage using **[shared_preferences](https://pub.dev/packages/shared_preferences)**. Supports light, dark, and system theme modes with smooth transitions and Material 3 design.
```dart
// Add theme toggle button
AppBar(
actions: [ThemeSwitcher.toggleButton(context)],
)
// Or use programmatically
themeNotifier.toggleTheme();
```
π **[View Complete Documentation](docs/THEMING.md)**
---
### π Localization
Internationalization support using **[intl](https://pub.dev/packages/intl)** package with language switching, RTL support, and persistent language preferences. Easy multi-language setup with date and number formatting per locale.
```dart
// Add language switcher
AppBar(
actions: [LanguageSwitcher.toggleButton()],
)
// Access translations
final text = context.jetI10n.confirm;
```
π **[View Complete Documentation](docs/LOCALIZATION.md)**
---
### π§ Environment Configuration
Type-safe environment variable management using `.env` files.
```dart
// Access environment variables with type safety
final apiUrl = JetEnv.getString('API_URL', defaultValue: 'http://localhost');
final timeout = JetEnv.getInt('API_TIMEOUT', defaultValue: 30);
final debugMode = JetEnv.getBool('ENABLE_DEBUG', defaultValue: false);
// Check if key exists
if (JetEnv.has('API_KEY')) {
final apiKey = JetEnv.getString('API_KEY');
}
```
π **[View Complete Documentation](docs/ENVIRONMENT.md)**
---
### π Networking
Type-safe HTTP client built on **[Dio](https://pub.dev/packages/dio)** with automatic error handling, interceptors, and beautiful console logging via **[pretty_dio_logger](https://pub.dev/packages/pretty_dio_logger)**. Supports FormData, request cancellation, and timeout handling.
```dart
class UserApiService extends JetApiService {
@override
String get baseUrl => 'https://api.example.com/v1';
Future> getUsers() async {
return await get>(
'/users',
decoder: (data) => (data as List)
.map((json) => User.fromJson(json))
.toList(),
);
}
}
```
π **[View Complete Documentation](docs/NETWORKING.md)**
---
### β οΈ Error Handling
Comprehensive error handling with `JetError` for consistent, type-safe error management.
```dart
try {
final result = await apiService.getData();
} on JetError catch (error) {
if (error.isValidation) {
// Handle validation errors
} else if (error.isNoInternet) {
// Handle network errors
}
}
```
π **[View Complete Documentation](docs/ERROR_HANDLING.md)**
---
### π Forms
Powerful, type-safe form management built with **[Flutter Hooks](https://pub.dev/packages/flutter_hooks)** and **[Riverpod 3](https://pub.dev/packages/riverpod)**. Two approaches available:
**π― Simple Forms** (recommended to start) - Use `useJetForm` hook for 80% of forms:
```dart
class LoginPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final form = useJetForm(
ref: ref,
decoder: (json) => LoginRequest.fromJson(json),
action: (request) => apiService.login(request),
onSuccess: (response, request) {
context.showToast('Welcome!');
context.router.push(const HomeRoute());
},
);
return JetSimpleForm(
form: form,
children: [
JetTextField(
name: 'email',
validator: JetValidators.compose([
JetValidators.required(),
JetValidators.email(),
]),
),
JetPasswordField(name: 'password'),
],
);
}
}
```
**π Advanced Forms** (for complex requirements) - Use `JetFormNotifier` for enterprise features:
```dart
@riverpod
class LoginForm extends _$LoginForm with JetFormMixin {
@override
AsyncFormValue build() {
return const AsyncFormIdle();
}
@override
LoginRequest decoder(Map json) => LoginRequest.fromJson(json);
@override
Future action(LoginRequest data) => apiService.login(data);
// Add custom validation, lifecycle hooks, etc.
}
```
**When to use each:**
- **Simple Forms**: Login, registration, settings, contact forms (80% of cases)
- **Advanced Forms**: Multi-step wizards, conditional fields, complex validation (20% of cases)
**Key Features:**
- π Type-safe with `Request`/`Response` generics
- β
70+ built-in validators (email, phone, password, credit card, etc.)
- π― 15+ form fields: text, password, dropdown, date/time, chips, sliders, OTP/PIN
- π Auto-localized error messages (English, Arabic, French)
- β‘ Performance optimized (70-90% fewer rebuilds)
- π Form change detection and reactive state
- π Password confirmation helpers
π **[Getting Started](docs/FORMS.md)** | **[Simple Forms Guide](docs/FORMS_SIMPLE.md)** | **[Advanced Forms Guide](docs/FORMS_ADVANCED.md)** | **[Form Fields Reference](docs/FORM_FIELDS.md)**
---
### π§© Components
Pre-built UI components with consistent styling and automatic loading states. Built on Flutter's Material/Cupertino widgets with **[smooth_page_indicator](https://pub.dev/packages/smooth_page_indicator)** for beautiful carousel indicators.
#### JetButton
```dart
JetButton.filled(
text: 'Submit',
onTap: () async {
await submitData();
},
)
```
#### JetTab
```dart
JetTab.simple(
keepAlive: true,
lazyLoad: true,
tabs: ['Home', 'Profile', 'Settings'],
children: [HomeView(), ProfileView(), SettingsView()],
)
```
#### JetCarousel
```dart
JetCarousel(
items: products,
autoPlay: true,
builder: (context, index, product) => ProductCard(product: product),
)
```
π **[View Complete Documentation](docs/COMPONENTS.md)**
---
### π¬ Dialogs & Sheets
Beautiful, adaptive dialogs and bottom sheets with built-in confirmation workflows.
```dart
// Adaptive confirmation dialog
await showAdaptiveConfirmationDialog(
context: context,
title: 'Delete Account',
message: 'Are you sure?',
onConfirm: () async {
await deleteAccount();
},
);
// Confirmation bottom sheet
showConfirmationSheet(
context: context,
title: 'Save Changes',
message: 'Do you want to save your changes?',
type: ConfirmationSheetType.success,
onConfirm: () async {
await saveChanges();
},
);
```
π **[View Complete Documentation](docs/DIALOGS_AND_SHEETS.md)**
---
### π― Extensions
Powerful Dart extension methods for BuildContext, Text, DateTime, and Number classes. Uses **[intl](https://pub.dev/packages/intl)** for date formatting with no performance overhead (compile-time extensions).
```dart
// Context extensions
context.showToast('Success!');
if (context.isAndroid) { /* ... */ }
// Text extensions
Text('Title').titleLarge(context).bold().color(Colors.blue)
// DateTime extensions
final formatted = now.formattedDate(format: 'MMM dd, yyyy');
// Number extensions
final orderId = 123.toOrderId(); // "00123"
```
π **[View Complete Documentation](docs/EXTENSIONS.md)**
---
### π Security
App locking with biometric authentication using **[Guardo](https://pub.dev/packages/guardo)** . Supports fingerprint, face ID, iris scan with PIN/pattern fallback and secure storage via **[flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage)**.
```dart
// Enable app lock
SwitchListTile(
title: Text('App Lock'),
value: ref.watch(appLockProvider),
onChanged: (enabled) {
ref.read(appLockProvider.notifier).toggle(context);
},
)
```
π **[View Complete Documentation](docs/SECURITY.md)**
---
### π Sessions
Built-in session management for user authentication with encrypted storage via **[flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage)** and reactive state through **[Riverpod](https://pub.dev/packages/riverpod)**. Automatic session persistence across app restarts.
```dart
// Login user
await SessionManager.authenticateAsUser(session: session);
// Check session
final session = await SessionManager.session();
// Logout
await SessionManager.clear();
```
π **[View Complete Documentation](docs/SESSIONS.md)**
---
### π State Management
Powerful state management built on **[Riverpod 3](https://pub.dev/packages/riverpod)** with **[riverpod_annotation](https://pub.dev/packages/riverpod_annotation)** code generation and enhanced widgets. JetPaginator uses **[infinite_scroll_pagination](https://pub.dev/packages/infinite_scroll_pagination)** for infinite scroll with any API format.
#### JetBuilder
```dart
// Simple list with pull-to-refresh
JetBuilder.list(
provider: postsProvider,
itemBuilder: (post, index) => PostCard(post: post),
)
```
#### JetPaginator
```dart
// Infinite scroll with any API format
JetPaginator.list>(
fetchPage: (pageKey) => api.getProducts(skip: pageKey, limit: 20),
parseResponse: (response, pageKey) => PageInfo(
items: (response['products'] as List)
.map((json) => Product.fromJson(json))
.toList(),
nextPageKey: response['skip'] + response['limit'] < response['total']
? response['skip'] + response['limit']
: null,
),
itemBuilder: (product, index) => ProductCard(product: product),
)
```
π **[View Complete Documentation](docs/STATE_MANAGEMENT.md)**
---
### π Notifications
Comprehensive local notification system built on **[flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications)** with **[timezone](https://pub.dev/packages/timezone)** support for scheduling. Event-driven architecture with type-safe handlers, action buttons, and custom notification channels.
```dart
// Send notification
await JetNotifications.sendNotification(
title: "Hello from Jet!",
body: "This is a notification",
payload: "notification_id",
);
// Schedule notification
await JetNotifications.sendNotification(
title: "Reminder",
body: "Don't forget!",
at: DateTime.now().add(Duration(hours: 1)),
);
// Event-driven notifications
class OrderNotificationEvent extends JetNotificationEvent {
@override
Future onTap(NotificationResponse response) async {
final orderId = int.parse(response.payload ?? '0');
router.push(OrderDetailsRoute(orderId: orderId));
}
}
```
π **[View Complete Documentation](docs/NOTIFICATIONS.md)**
---
### π Debugging
Comprehensive logging utilities with colored console output, clickable file paths, and environment-aware logging for enhanced debugging experience.
```dart
// Enhanced logging
dump('Debug message', tag: 'DEBUG');
JetLogger.json(responseData);
```
π **[View Complete Documentation](docs/DEBUGGING.md)**
---
### π Helpers
Development utilities for debugging and productivity.
```dart
// Monitor Riverpod state changes with LoggerObserver
ProviderScope(
observers: [LoggerObserver()],
child: MyApp(),
)
// Logs provider updates, additions, and disposals
// [Provider Added] myCounterProvider = 0
// [Provider Updated] myCounterProvider from 0 to 1
```
π **[View Complete Documentation](docs/HELPERS.md)**
---
## π― Key Features Summary
- **π Rapid Development** - Get started in minutes
- **π± Modern Architecture** - Built on Riverpod 3
- **π§ Type Safety** - Full type safety across the framework
- **π Internationalization** - Built-in localization with RTL
- **π¨ Theming** - Complete theme management
- **π Security** - App locking and secure storage
- **π Forms** - Advanced form management
- **π Networking** - Type-safe HTTP client
- **π State Management** - Enhanced Riverpod widgets
- **π Notifications** - Event-driven notifications
- **π§© Components** - Pre-built UI components
## π Documentation
### Core Features
- [Configuration](docs/CONFIGURATION.md) - App configuration
- [Routing](docs/ROUTING.md) - Navigation and routing
- [Adapters](docs/ADAPTERS.md) - Framework extensions
- [Storage](docs/STORAGE.md) - Local storage
- [Theming](docs/THEMING.md) - Theme management
- [Localization](docs/LOCALIZATION.md) - Internationalization
### Advanced Features
- [Networking](docs/NETWORKING.md) - HTTP client
- [Error Handling](docs/ERROR_HANDLING.md) - Error management
- [Forms](docs/FORMS.md) - Form management, validation, and fields
- [Components](docs/COMPONENTS.md) - UI components
- [Dialogs & Sheets](docs/DIALOGS_AND_SHEETS.md) - Confirmation workflows
### Utilities
- [Environment](docs/ENVIRONMENT.md) - Environment configuration (.env files)
- [Extensions](docs/EXTENSIONS.md) - Utility extensions
- [Security](docs/SECURITY.md) - App security
- [Sessions](docs/SESSIONS.md) - Session management
- [State Management](docs/STATE_MANAGEMENT.md) - Riverpod integration
- [Notifications](docs/NOTIFICATIONS.md) - Local notifications
- [Debugging](docs/DEBUGGING.md) - Debugging tools
- [Helpers](docs/HELPERS.md) - Utility helpers
## π Additional Resources
### Official Documentation
- [Riverpod Documentation](https://riverpod.dev/)
- [AutoRoute Documentation](https://auto-route.vercel.app/)
- [Dio Documentation](https://pub.dev/packages/dio)
### Learning Resources
- [Flutter Official Docs](https://flutter.dev/docs)
- [Dart Language Tour](https://dart.dev/guides/language/language-tour)
- [Material Design 3](https://m3.material.io/)
## π€ Contributing
We welcome contributions! Please see our contributing guidelines for details.
## π License
This project is licensed under the MIT License - see the LICENSE file for details.