|
1 | 1 | # What Is Bond |
2 | 2 |
|
3 | | -## Introduction |
| 3 | +Welcome to Flutter Bond - a comprehensive toolkit for building production-ready Flutter applications with speed and confidence. |
4 | 4 |
|
5 | | -Bond is a comprehensive Flutter development toolkit designed to accelerate the creation of production-ready mobile applications. At its core, Bond provides a cohesive set of packages, tools, and conventions that eliminate the repetitive setup work typically required when starting a new Flutter project. |
| 5 | +## What You'll Learn |
6 | 6 |
|
7 | | -Think of Bond as the "Laravel for Flutter" - it provides opinionated yet flexible solutions for common mobile app requirements like networking, caching, form validation, push notifications, analytics, and authentication. Rather than piecing together disparate packages and figuring out how to make them work together, Bond gives you a unified ecosystem where everything is designed to work seamlessly. |
| 7 | +This section introduces Bond's core philosophy and helps you understand why it exists and how it can transform your Flutter development experience. |
8 | 8 |
|
9 | | -## The Problem Bond Solves |
| 9 | +### What Is Bond |
10 | 10 |
|
11 | | -When building Flutter applications, developers often face the same challenges repeatedly: |
| 11 | +Discover what makes Bond different from other Flutter frameworks and how it solves common development challenges through unified architecture and proven patterns. |
12 | 12 |
|
13 | | -- **Boilerplate Setup**: Every new project requires the same tedious setup for networking, state management, dependency injection, and build configurations |
14 | | -- **Package Integration**: Figuring out how to make different packages work together harmoniously |
15 | | -- **Architecture Decisions**: Determining how to structure code, organize features, and manage dependencies |
16 | | -- **Production Readiness**: Implementing flavors, CI/CD, analytics, crash reporting, and other production concerns |
17 | | -- **Team Consistency**: Ensuring all team members follow the same patterns and conventions |
| 13 | +### [Philosophy](./philosophy/) |
18 | 14 |
|
19 | | -Bond addresses these challenges by providing: |
| 15 | +Understand the design principles behind Bond, including convention over configuration, explicit dependencies, type safety, and developer experience first. |
20 | 16 |
|
21 | | -1. **A Starter Template**: A production-ready Flutter app with all the essential setup already done |
22 | | -2. **Core Packages**: A suite of packages that work together seamlessly |
23 | | -3. **CLI Tools**: Commands to generate new projects, features, and boilerplate code |
24 | | -4. **Clear Conventions**: Opinionated but flexible patterns for organizing code and managing dependencies |
| 17 | +### [Upgrades](./upgrades/) |
25 | 18 |
|
26 | | -## What's in the Box |
| 19 | +Learn about Bond's versioning strategy, migration tools, and how to keep your applications up-to-date with the latest Bond features. |
27 | 20 |
|
28 | | -Bond consists of four main components: |
| 21 | +## Quick Navigation |
29 | 22 |
|
30 | | -### 1. Flutter Bond (Starter App) |
| 23 | +- **New to Bond?** Start with [What Is Bond](./what-is-bond/) to understand the framework |
| 24 | +- **Ready to build?** Jump to [Getting Started](/getting-started/) to create your first project |
| 25 | +- **Want to understand the architecture?** Read about [Philosophy](./philosophy/) and design decisions |
31 | 26 |
|
32 | | -The `flutter-bond` repository provides a complete starter application that includes: |
| 27 | +## Key Concepts |
33 | 28 |
|
34 | | -- **Multi-flavor setup** (production, staging) with separate Firebase configurations |
35 | | -- **Environment management** using `--dart-define-from-file` |
36 | | -- **Service Provider architecture** for dependency injection and feature organization |
37 | | -- **Pre-configured packages** for networking, caching, forms, notifications, and analytics |
38 | | -- **Build automation** with scripts for Firebase setup and app configuration |
39 | | -- **Production-ready structure** with proper asset management, localization, and theming |
| 29 | +- **Service Providers**: Organize dependencies and feature boundaries |
| 30 | +- **Typed Everything**: Compile-time safety for networking, forms, and data |
| 31 | +- **Convention over Configuration**: Sensible defaults that scale |
| 32 | +- **Developer Experience**: Tools and patterns that make Flutter development enjoyable |
40 | 33 |
|
41 | | -### 2. Bond Core (Package Ecosystem) |
42 | | - |
43 | | -The `bond-core` monorepo contains specialized packages for common mobile app needs: |
44 | | - |
45 | | -- **Core**: Base classes for Service Providers and response decoding |
46 | | -- **Network (BondFire)**: Typed HTTP client built on Dio with caching and error handling |
47 | | -- **Cache**: Flexible caching system with multiple drivers and object serialization |
48 | | -- **Form**: Comprehensive form state management with validation and Riverpod integration |
49 | | -- **Notifications (Beacon)**: Unified push and local notification handling with routing |
50 | | -- **App Analytics**: Event tracking with provider adapters for Firebase, AppsFlyer, etc. |
51 | | -- **Socialite**: Social authentication utilities and helpers |
52 | | - |
53 | | -### 3. Bond CLI (Development Tools) |
54 | | - |
55 | | -The `bond-cli` package provides command-line tools for: |
56 | | - |
57 | | -- **Project Creation**: Generate new Bond projects with interactive setup |
58 | | -- **Feature Generation**: Scaffold new features with proper Service Provider structure |
59 | | -- **Configuration Updates**: Change app names, bundle IDs, and package names |
60 | | -- **Authentication Setup**: Add social login providers like Google, Apple, Facebook |
61 | | - |
62 | | -### 4. Bond Docs (This Documentation) |
63 | | - |
64 | | -Comprehensive documentation covering: |
65 | | - |
66 | | -- **Getting Started**: Step-by-step tutorials for new projects |
67 | | -- **Core Concepts**: Deep dives into Service Providers, architecture, and patterns |
68 | | -- **Package Guides**: Detailed usage instructions for each Bond package |
69 | | -- **Recipes**: Common patterns and solutions for typical mobile app features |
70 | | -- **Advanced Topics**: Performance optimization, testing strategies, and customization |
71 | | - |
72 | | -## Real-World Example |
73 | | - |
74 | | -Let's see how Bond simplifies a common scenario - adding user authentication to your app: |
75 | | - |
76 | | -### Without Bond (Traditional Approach) |
77 | | - |
78 | | -```dart |
79 | | -// 1. Choose and configure packages |
80 | | -dependencies: |
81 | | - dio: ^5.0.0 |
82 | | - shared_preferences: ^2.0.0 |
83 | | - flutter_secure_storage: ^9.0.0 |
84 | | - riverpod: ^2.0.0 |
85 | | - # ... many more |
86 | | -
|
87 | | -// 2. Set up networking |
88 | | -class ApiClient { |
89 | | - late Dio _dio; |
90 | | - |
91 | | - ApiClient() { |
92 | | - _dio = Dio(BaseOptions( |
93 | | - baseUrl: 'https://api.example.com', |
94 | | - // ... lots of configuration |
95 | | - )); |
96 | | - |
97 | | - // Add interceptors for auth, logging, etc. |
98 | | - } |
99 | | -} |
100 | | -
|
101 | | -// 3. Create models and serialization |
102 | | -@JsonSerializable() |
103 | | -class User { |
104 | | - // ... model definition |
105 | | -} |
106 | | -
|
107 | | -// 4. Build repository |
108 | | -class AuthRepository { |
109 | | - // ... implementation |
110 | | -} |
111 | | -
|
112 | | -// 5. Set up state management |
113 | | -// 6. Handle errors and loading states |
114 | | -// 7. Configure dependency injection |
115 | | -// ... hundreds of lines of boilerplate |
116 | | -``` |
117 | | - |
118 | | -### With Bond |
119 | | - |
120 | | -```dart |
121 | | -// 1. Create project |
122 | | -$ bond create project my_app |
123 | | -
|
124 | | -// 2. Add authentication feature |
125 | | -$ bond add auth |
126 | | -
|
127 | | -// 3. Use the generated provider |
128 | | -class AuthServiceProvider extends ServiceProvider with ResponseDecoding { |
129 | | - @override |
130 | | - Future<void> register(GetIt it) async { |
131 | | - it.registerLazySingleton<AuthRepository>(() => AuthRepository(it())); |
132 | | - } |
133 | | -
|
134 | | - @override |
135 | | - Map<Type, JsonFactory> get factories => { |
136 | | - User: (json) => User.fromJson(json), |
137 | | - }; |
138 | | -} |
139 | | -
|
140 | | -// 4. Use in your UI |
141 | | -final authRepo = GetIt.instance<AuthRepository>(); |
142 | | -await authRepo.login(email, password); |
143 | | -``` |
144 | | - |
145 | | -The Bond approach eliminates hundreds of lines of boilerplate and provides a tested, production-ready foundation. |
146 | | - |
147 | | -## Key Benefits |
148 | | - |
149 | | -### 1. Faster Development |
150 | | - |
151 | | -Bond eliminates the "blank page" problem. Instead of spending days setting up basic infrastructure, you can focus on building your app's unique features from day one. |
152 | | - |
153 | | -### 2. Consistent Architecture |
154 | | - |
155 | | -The Service Provider pattern and clear conventions ensure that all team members structure code the same way, making collaboration easier and code reviews more focused. |
156 | | - |
157 | | -### 3. Production Ready |
158 | | - |
159 | | -Bond includes all the production concerns you'll eventually need: multiple environments, analytics, crash reporting, push notifications, and proper build configurations. |
160 | | - |
161 | | -### 4. Testable by Design |
162 | | - |
163 | | -The dependency injection system and clear separation of concerns make it easy to write unit tests, integration tests, and widget tests. |
164 | | - |
165 | | -### 5. Scalable Structure |
166 | | - |
167 | | -The feature-based organization and modular architecture scale from small prototypes to large enterprise applications. |
168 | | - |
169 | | -## Who Should Use Bond |
170 | | - |
171 | | -Bond is ideal for: |
172 | | - |
173 | | -- **Startup Teams** who need to move fast and validate ideas quickly |
174 | | -- **Enterprise Teams** who want consistent architecture across multiple apps |
175 | | -- **Solo Developers** who don't want to reinvent the wheel for each project |
176 | | -- **Teams New to Flutter** who want to learn best practices from the start |
177 | | -- **Experienced Developers** who want to focus on business logic rather than infrastructure |
178 | | - |
179 | | -## Getting Started |
180 | | - |
181 | | -Ready to try Bond? Here's what to do next: |
182 | | - |
183 | | -1. **Install the CLI**: `dart pub global activate bond_cli` |
184 | | -2. **Create a Project**: `bond create project` |
185 | | -3. **Follow the Tutorial**: Continue with [Getting Started](/docs/getting-started) |
186 | | -4. **Join the Community**: Connect with other Bond developers |
187 | | - |
188 | | -## Philosophy and Design Principles |
189 | | - |
190 | | -Bond is built on several key principles: |
191 | | - |
192 | | -### Convention over Configuration |
193 | | - |
194 | | -While Bond is flexible, it provides sensible defaults and conventions that work for most applications. This reduces decision fatigue and helps teams move faster. |
195 | | - |
196 | | -### Explicit Dependencies |
197 | | - |
198 | | -Using the Service Provider pattern with GetIt makes all dependencies explicit and testable. No hidden global state or magic. |
199 | | - |
200 | | -### Gradual Adoption |
201 | | - |
202 | | -You can adopt Bond incrementally. Start with just the networking package, or use the full starter template - it's up to you. |
203 | | - |
204 | | -### Developer Experience First |
205 | | - |
206 | | -Every decision in Bond prioritizes developer experience. From clear error messages to comprehensive documentation, Bond aims to make Flutter development enjoyable. |
207 | | - |
208 | | -## Next Steps |
209 | | - |
210 | | -Now that you understand what Bond is and why it exists, you're ready to: |
211 | | - |
212 | | -- [Learn the Philosophy](/docs/overview/philosophy) - Understand the design principles behind Bond |
213 | | -- [Start Building](/docs/getting-started) - Create your first Bond application |
214 | | -- [Explore the Packages](/docs/guides) - Deep dive into Bond's capabilities |
| 34 | +Ready to dive in? Continue with [What Is Bond](./what-is-bond/) or jump straight to [Getting Started](/getting-started/). |
0 commit comments