reis-mobile 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +24 -0
- package/.claude-plugin/plugin.json +12 -0
- package/CHANGELOG.md +103 -0
- package/LICENSE +21 -0
- package/README.md +631 -0
- package/THIRD_PARTY_NOTICES.md +105 -0
- package/agents/flutter-architect.md +92 -0
- package/agents/flutter-performance-engineer.md +103 -0
- package/agents/flutter-test-engineer.md +100 -0
- package/agents/lead-mobile.md +107 -0
- package/agents/mobile-code-reviewer.md +66 -0
- package/agents/mobile-staff-engineer.md +85 -0
- package/agents/plugin-native-expert.md +97 -0
- package/bin/reis-mobile.mjs +256 -0
- package/commands/debate.md +135 -0
- package/commands/doctor.md +23 -0
- package/commands/reis-mobile.md +50 -0
- package/commands/review.md +53 -0
- package/core/config/language.mjs +83 -0
- package/core/context/context-engine.mjs +113 -0
- package/core/detection/project-probe.mjs +104 -0
- package/core/detection/stack-detector.mjs +204 -0
- package/core/diagnostics/doctor.mjs +181 -0
- package/core/install/claude-plugin.mjs +76 -0
- package/core/paths.mjs +4 -0
- package/core/registry/frontmatter.mjs +81 -0
- package/core/registry/registry.mjs +140 -0
- package/core/router/intent-detector.mjs +75 -0
- package/core/router/intents.mjs +91 -0
- package/core/router/router.mjs +83 -0
- package/core/security/redact.mjs +24 -0
- package/package.json +35 -0
- package/skills/architecture-feature-first/SKILL.md +116 -0
- package/skills/bloc/SKILL.md +354 -0
- package/skills/code-review/SKILL.md +89 -0
- package/skills/dart-3-updates/SKILL.md +223 -0
- package/skills/dart-add-unit-test/SKILL.md +126 -0
- package/skills/dart-collect-coverage/SKILL.md +145 -0
- package/skills/dart-fix-runtime-errors/SKILL.md +170 -0
- package/skills/dart-generate-test-mocks/SKILL.md +159 -0
- package/skills/dart-migrate-to-checks-package/SKILL.md +532 -0
- package/skills/dart-resolve-package-conflicts/SKILL.md +120 -0
- package/skills/dart-run-static-analysis/SKILL.md +108 -0
- package/skills/dart-use-pattern-matching/SKILL.md +240 -0
- package/skills/dart-use-pattern-matching/examples/json_patterns.dart +85 -0
- package/skills/detect-mobile-stack/SKILL.md +33 -0
- package/skills/effective-dart/SKILL.md +187 -0
- package/skills/firebase-ai/SKILL.md +93 -0
- package/skills/firebase-analytics/SKILL.md +129 -0
- package/skills/firebase-app-check/SKILL.md +124 -0
- package/skills/firebase-auth/SKILL.md +224 -0
- package/skills/firebase-cloud-firestore/SKILL.md +165 -0
- package/skills/firebase-cloud-functions/SKILL.md +148 -0
- package/skills/firebase-crashlytics/SKILL.md +182 -0
- package/skills/firebase-data-connect/SKILL.md +80 -0
- package/skills/firebase-database/SKILL.md +224 -0
- package/skills/firebase-in-app-messaging/SKILL.md +111 -0
- package/skills/firebase-messaging/SKILL.md +201 -0
- package/skills/firebase-remote-config/SKILL.md +131 -0
- package/skills/firebase-storage/SKILL.md +158 -0
- package/skills/flutter-add-integration-test/SKILL.md +167 -0
- package/skills/flutter-add-widget-preview/SKILL.md +149 -0
- package/skills/flutter-add-widget-test/SKILL.md +158 -0
- package/skills/flutter-adding-home-screen-widgets/SKILL.md +205 -0
- package/skills/flutter-animating-apps/SKILL.md +185 -0
- package/skills/flutter-app-architecture/SKILL.md +80 -0
- package/skills/flutter-apply-architecture-best-practices/SKILL.md +166 -0
- package/skills/flutter-build-responsive-layout/SKILL.md +143 -0
- package/skills/flutter-building-forms/SKILL.md +125 -0
- package/skills/flutter-building-layouts/SKILL.md +131 -0
- package/skills/flutter-building-plugins/SKILL.md +209 -0
- package/skills/flutter-caching-data/SKILL.md +171 -0
- package/skills/flutter-change-notifier/SKILL.md +138 -0
- package/skills/flutter-embedding-native-views/SKILL.md +200 -0
- package/skills/flutter-errors/SKILL.md +126 -0
- package/skills/flutter-fix-layout-issues/SKILL.md +134 -0
- package/skills/flutter-handling-concurrency/SKILL.md +182 -0
- package/skills/flutter-implement-json-serialization/SKILL.md +157 -0
- package/skills/flutter-improving-accessibility/SKILL.md +113 -0
- package/skills/flutter-interoperating-with-native-apis/SKILL.md +130 -0
- package/skills/flutter-login-usecase/SKILL.md +38 -0
- package/skills/flutter-managing-state/SKILL.md +206 -0
- package/skills/flutter-project-audit/SKILL.md +66 -0
- package/skills/flutter-reducing-app-size/SKILL.md +103 -0
- package/skills/flutter-secure-token-store/SKILL.md +35 -0
- package/skills/flutter-setting-up-on-macos/SKILL.md +78 -0
- package/skills/flutter-setup-declarative-routing/SKILL.md +259 -0
- package/skills/flutter-setup-localization/SKILL.md +214 -0
- package/skills/flutter-theming-apps/SKILL.md +163 -0
- package/skills/flutter-use-http-package/SKILL.md +178 -0
- package/skills/flutter-widget-review/SKILL.md +54 -0
- package/skills/flutter-working-with-databases/SKILL.md +203 -0
- package/skills/flutterfire-configure/SKILL.md +143 -0
- package/skills/mobile-security-audit/SKILL.md +101 -0
- package/skills/mockito/SKILL.md +149 -0
- package/skills/mocktail/SKILL.md +122 -0
- package/skills/patrol-e2e-testing/SKILL.md +224 -0
- package/skills/provider/SKILL.md +139 -0
- package/skills/riverpod/SKILL.md +246 -0
- package/skills/testing/SKILL.md +50 -0
- package/stacks/android/stack.json +8 -0
- package/stacks/flutter/stack.json +8 -0
- package/stacks/ios/stack.json +8 -0
- package/stacks/kotlin-multiplatform/stack.json +8 -0
- package/stacks/react-native/stack.json +8 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: effective-dart
|
|
3
|
+
description: Applies Effective Dart guidelines in Flutter/Dart code. Use when writing or reviewing Dart code for naming conventions, types, style, imports, file structure, usage patterns, documentation, testing, widgets, state management, or performance.
|
|
4
|
+
intents: [review]
|
|
5
|
+
stacks: [flutter]
|
|
6
|
+
source: https://github.com/evanca/flutter-ai-rules
|
|
7
|
+
license: MIT
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Effective Dart Skill
|
|
11
|
+
|
|
12
|
+
This skill defines how to write idiomatic, high-quality Dart and Flutter code following Effective Dart guidelines.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 1. Naming Conventions
|
|
17
|
+
|
|
18
|
+
| Kind | Convention | Example |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| Classes, enums, typedefs, type parameters, extensions | `UpperCamelCase` | `MyWidget`, `UserState` |
|
|
21
|
+
| Packages, directories, source files | `lowercase_with_underscores` | `user_profile.dart` |
|
|
22
|
+
| Import prefixes | `lowercase_with_underscores` | `import '...' as my_prefix;` |
|
|
23
|
+
| Variables, parameters, named parameters, functions | `lowerCamelCase` | `userName`, `fetchData()` |
|
|
24
|
+
|
|
25
|
+
- Capitalize acronyms and abbreviations longer than two letters like words: `HttpRequest`, not `HTTPRequest`.
|
|
26
|
+
- Avoid abbreviations unless the abbreviation is more common than the full term.
|
|
27
|
+
- Prefer putting the **most descriptive noun last** in names.
|
|
28
|
+
- Use terms **consistently** throughout your code.
|
|
29
|
+
- Follow mnemonic conventions for type parameters: `E` (element), `K`/`V` (key/value), `T`/`S`/`U` (generic types).
|
|
30
|
+
- Consider making code **read like a sentence** when designing APIs.
|
|
31
|
+
- Prefer a **noun phrase** for non-boolean properties or variables.
|
|
32
|
+
- Prefer a **non-imperative verb phrase** for boolean properties or variables; prefer the positive form.
|
|
33
|
+
- Consider omitting the verb for named boolean parameters.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Types and Functions
|
|
38
|
+
|
|
39
|
+
- Use **class modifiers** to control if a class can be extended or used as an interface.
|
|
40
|
+
- **Type annotate variables** without initializers.
|
|
41
|
+
- Type annotate **fields and top-level variables** if the type isn't obvious.
|
|
42
|
+
- **Annotate return types** on function declarations.
|
|
43
|
+
- **Annotate parameter types** on function declarations.
|
|
44
|
+
- Write **type arguments** on generic invocations that aren't inferred.
|
|
45
|
+
- Annotate with `dynamic` instead of letting inference fail.
|
|
46
|
+
- Use `Future<void>` as the return type of async members that do not produce values.
|
|
47
|
+
- Use **getters** for operations that conceptually access properties.
|
|
48
|
+
- Use **setters** for operations that conceptually change properties.
|
|
49
|
+
- Use a **function declaration** to bind a function to a name.
|
|
50
|
+
- Use **inclusive start and exclusive end** parameters to accept a range.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 3. Style
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
dart format .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- Format code with `dart format` — don't manually format.
|
|
61
|
+
- Use **curly braces** for all flow control statements.
|
|
62
|
+
- Prefer `final` over `var` when variable values won't change.
|
|
63
|
+
- Use `const` for compile-time constants.
|
|
64
|
+
- Prefer lines **80 characters or fewer** for readability.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 4. Imports and Files
|
|
69
|
+
|
|
70
|
+
- Don't import libraries inside the `src` directory of another package.
|
|
71
|
+
- Don't allow import paths to reach into or out of `lib`.
|
|
72
|
+
- **Prefer relative import paths** within a package.
|
|
73
|
+
- Don't use `/lib/` or `../` in import paths.
|
|
74
|
+
- Consider writing a **library-level doc comment** for library files.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 5. Structure
|
|
79
|
+
|
|
80
|
+
- Keep files **focused on a single responsibility**.
|
|
81
|
+
- Limit file length to maintain readability.
|
|
82
|
+
- Group related functionality together.
|
|
83
|
+
- Prefer making fields and top-level variables `final`.
|
|
84
|
+
- Consider making constructors `const` if the class supports it.
|
|
85
|
+
- **Prefer making declarations private** — only expose what's necessary.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 6. Usage
|
|
90
|
+
|
|
91
|
+
```dart
|
|
92
|
+
// Adjacent string concatenation (not +)
|
|
93
|
+
final greeting = 'Hello, '
|
|
94
|
+
'world!';
|
|
95
|
+
|
|
96
|
+
// Collection literals
|
|
97
|
+
final list = [1, 2, 3];
|
|
98
|
+
final map = {'key': 'value'};
|
|
99
|
+
|
|
100
|
+
// Initializing formals
|
|
101
|
+
class Point {
|
|
102
|
+
final double x, y;
|
|
103
|
+
Point(this.x, this.y);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Empty constructor body
|
|
107
|
+
class Empty {
|
|
108
|
+
Empty(); // not Empty() {}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// rethrow
|
|
112
|
+
try {
|
|
113
|
+
doSomething();
|
|
114
|
+
} catch (e) {
|
|
115
|
+
log(e);
|
|
116
|
+
rethrow;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- Use `whereType()` to filter a collection by type.
|
|
121
|
+
- Follow a **consistent rule** for `var` and `final` on local variables.
|
|
122
|
+
- Initialize fields at their **declaration** when possible.
|
|
123
|
+
- Override `hashCode` if you override `==`; ensure `==` obeys mathematical equality rules.
|
|
124
|
+
- **Prefer specific exception handling**: use `on SomeException catch (e)` instead of broad `catch (e)` or `.catchError` handlers.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 7. Documentation
|
|
129
|
+
|
|
130
|
+
```dart
|
|
131
|
+
/// Returns the sum of [a] and [b].
|
|
132
|
+
///
|
|
133
|
+
/// Throws [ArgumentError] if either value is negative.
|
|
134
|
+
int add(int a, int b) { ... }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
- Format comments like sentences (capitalize, end with period).
|
|
138
|
+
- Use `///` doc comments — not `/* */` block comments — for types and members.
|
|
139
|
+
- Prefer writing doc comments for **public APIs**; consider them for private APIs too.
|
|
140
|
+
- Start doc comments with a **single-sentence summary**, separated into its own paragraph.
|
|
141
|
+
- Avoid redundancy with the surrounding context.
|
|
142
|
+
- Start function/method comments with a **third-person verb** if the main purpose is a side effect.
|
|
143
|
+
- Start with a **noun or non-imperative verb phrase** if returning a value is the primary purpose.
|
|
144
|
+
- Start **boolean** variable/property comments with "Whether followed by a noun or gerund phrase.
|
|
145
|
+
- Use `[identifier]` in doc comments to refer to in-scope identifiers.
|
|
146
|
+
- Use **prose** to explain parameters, return values, and exceptions (e.g., "The [param]", "Returns", "Throws" sections).
|
|
147
|
+
- Put doc comments **before** metadata annotations.
|
|
148
|
+
- Document **why** code exists or how it should be used, not just what it does.
|
|
149
|
+
- When referring to the current object, prefer "this box" over bare "this".
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 8. Testing
|
|
154
|
+
|
|
155
|
+
- Write **unit tests** for business logic.
|
|
156
|
+
- Write **widget tests** for UI components.
|
|
157
|
+
- Aim for **good test coverage**.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## 9. Widgets
|
|
162
|
+
|
|
163
|
+
- Extract reusable widgets into **separate components**.
|
|
164
|
+
- Use `StatelessWidget` when possible.
|
|
165
|
+
- Keep **build methods simple and focused**.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 10. State Management
|
|
170
|
+
|
|
171
|
+
- Choose appropriate state management based on **complexity**.
|
|
172
|
+
- Avoid unnecessary `StatefulWidget`s.
|
|
173
|
+
- Keep **state as local as possible**.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 11. Performance
|
|
178
|
+
|
|
179
|
+
- Use `const` constructors when possible.
|
|
180
|
+
- Avoid **expensive operations** in build methods.
|
|
181
|
+
- Implement **pagination** for large lists.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## References
|
|
186
|
+
|
|
187
|
+
- [Dart Site WWW GitHub Repository](https://github.com/dart-lang/site-www)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: firebase-ai
|
|
3
|
+
description: Integrates Firebase AI Logic into Flutter apps. Use when setting up the firebase_ai plugin, calling Gemini models, handling AI service errors, or applying security and privacy considerations for AI features.
|
|
4
|
+
routing: manual
|
|
5
|
+
stacks: [flutter]
|
|
6
|
+
source: https://github.com/evanca/flutter-ai-rules
|
|
7
|
+
license: MIT
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Firebase AI Skill
|
|
11
|
+
|
|
12
|
+
This skill defines how to correctly use Firebase AI Logic in Flutter applications.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
Use this skill when:
|
|
17
|
+
|
|
18
|
+
* Setting up and configuring Firebase AI in a Flutter project.
|
|
19
|
+
* Implementing AI features on supported platforms.
|
|
20
|
+
* Handling errors and offline scenarios for AI operations.
|
|
21
|
+
* Applying security and privacy considerations for AI features.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1. Setup and Configuration
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
flutter pub add firebase_ai
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```dart
|
|
32
|
+
import 'package:firebase_ai/firebase_ai.dart';
|
|
33
|
+
import 'package:firebase_core/firebase_core.dart';
|
|
34
|
+
import 'firebase_options.dart';
|
|
35
|
+
|
|
36
|
+
// Initialize FirebaseApp
|
|
37
|
+
await Firebase.initializeApp(
|
|
38
|
+
options: DefaultFirebaseOptions.currentPlatform,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// Initialize the Gemini Developer API backend service
|
|
42
|
+
// Create a GenerativeModel instance with a model that supports your use case
|
|
43
|
+
final model =
|
|
44
|
+
FirebaseAI.googleAI().generativeModel(model: 'gemini-2.5-flash');
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- Ensure your Firebase project is properly configured for AI services (via the Firebase AI Logic page in the Firebase Console).
|
|
48
|
+
- Initialize Firebase before using any Firebase AI features.
|
|
49
|
+
- Use `FirebaseAI.googleAI()` for the **Gemini Developer API** backend (recommended starting point).
|
|
50
|
+
- Consider implementing **App Check** to prevent abuse of your Firebase AI endpoints.
|
|
51
|
+
|
|
52
|
+
**Platform support:**
|
|
53
|
+
|
|
54
|
+
| Platform | Support |
|
|
55
|
+
|---|---|
|
|
56
|
+
| iOS | Full |
|
|
57
|
+
| Android | Full |
|
|
58
|
+
| Web | Full |
|
|
59
|
+
| macOS / other Apple | Beta |
|
|
60
|
+
| Windows | Not supported |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 2. Best Practices
|
|
65
|
+
|
|
66
|
+
- Be aware of **rate limits and quotas** when implementing AI features — monitor usage and costs in the Firebase Console.
|
|
67
|
+
- Handle AI service errors gracefully with appropriate **fallback mechanisms**.
|
|
68
|
+
- Consider **user privacy** when implementing AI features that process user data.
|
|
69
|
+
- Test AI functionality across all supported platforms during development.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 3. Error Handling
|
|
74
|
+
|
|
75
|
+
- Implement proper error handling for AI service failures.
|
|
76
|
+
- Provide meaningful error messages to users when AI operations fail.
|
|
77
|
+
- Handle **offline scenarios** and implement appropriate fallback behavior.
|
|
78
|
+
- Handle **rate limiting and quota exceeded** errors appropriately.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 4. Security
|
|
83
|
+
|
|
84
|
+
- Follow Firebase Security Rules best practices when using AI services alongside other Firebase products.
|
|
85
|
+
- Ensure proper **authentication and authorization** for AI feature access.
|
|
86
|
+
- Be mindful of **data privacy requirements** when processing user content with AI services.
|
|
87
|
+
- Implement appropriate **content filtering and moderation** as needed.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## References
|
|
92
|
+
|
|
93
|
+
- [Firebase AI Logic Flutter documentation](https://firebase.google.com/docs/ai-logic/get-started?platform=flutter)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: firebase-analytics
|
|
3
|
+
description: Integrates Firebase Analytics into Flutter apps. Use when setting up analytics, logging events, setting user properties, or configuring event parameters.
|
|
4
|
+
routing: manual
|
|
5
|
+
stacks: [flutter]
|
|
6
|
+
source: https://github.com/evanca/flutter-ai-rules
|
|
7
|
+
license: MIT
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Firebase Analytics Skill
|
|
11
|
+
|
|
12
|
+
This skill defines how to correctly use Firebase Analytics in Flutter applications.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
Use this skill when:
|
|
17
|
+
|
|
18
|
+
* Setting up and configuring Firebase Analytics in a Flutter project.
|
|
19
|
+
* Logging predefined or custom events.
|
|
20
|
+
* Setting user properties or default event parameters.
|
|
21
|
+
* Applying best practices for analytics data collection.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1. Setup and Configuration
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
flutter pub add firebase_analytics
|
|
29
|
+
flutter run
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```dart
|
|
33
|
+
import 'package:firebase_analytics/firebase_analytics.dart';
|
|
34
|
+
|
|
35
|
+
// After Firebase.initializeApp():
|
|
36
|
+
FirebaseAnalytics analytics = FirebaseAnalytics.instance;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- Initialize Firebase before using any Firebase Analytics features.
|
|
40
|
+
- Analytics **automatically logs** some events and user properties — no additional code needed for those.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 2. Event Logging
|
|
45
|
+
|
|
46
|
+
Use **predefined event methods** when possible for maximum detail in reports and access to future Google Analytics features:
|
|
47
|
+
|
|
48
|
+
```dart
|
|
49
|
+
await FirebaseAnalytics.instance.logSelectContent(
|
|
50
|
+
contentType: "image",
|
|
51
|
+
itemId: itemId,
|
|
52
|
+
);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Use the general `logEvent()` method for both predefined and custom events:
|
|
56
|
+
|
|
57
|
+
```dart
|
|
58
|
+
await FirebaseAnalytics.instance.logEvent(
|
|
59
|
+
name: "select_content",
|
|
60
|
+
parameters: {
|
|
61
|
+
"content_type": "image",
|
|
62
|
+
"item_id": itemId,
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Custom events:
|
|
68
|
+
|
|
69
|
+
```dart
|
|
70
|
+
await FirebaseAnalytics.instance.logEvent(
|
|
71
|
+
name: "share_image",
|
|
72
|
+
parameters: {
|
|
73
|
+
"image_name": name,
|
|
74
|
+
"full_text": text,
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- Event names are **case-sensitive** — names differing only in case create two distinct events.
|
|
80
|
+
- You can log up to **500 different event types** with no limit on total event volume.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 3. Parameters and Properties
|
|
85
|
+
|
|
86
|
+
- Parameter names: up to **40 characters**, must start with an alphabetic character, contain only alphanumeric characters and underscores.
|
|
87
|
+
- String parameter values: up to **100 characters**.
|
|
88
|
+
- The prefixes `firebase_`, `google_`, and `ga_` are **reserved** — do not use them for parameter names.
|
|
89
|
+
- Use custom parameters for non-numerical data (dimensions) or numerical data (metrics); register them in the Analytics console first.
|
|
90
|
+
|
|
91
|
+
Set default parameters for all future events (not supported on web):
|
|
92
|
+
|
|
93
|
+
```dart
|
|
94
|
+
await FirebaseAnalytics.instance.setDefaultEventParameters({
|
|
95
|
+
'version': '1.2.3',
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Clear a default parameter by setting it to `null`.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 4. User Properties
|
|
104
|
+
|
|
105
|
+
```dart
|
|
106
|
+
await FirebaseAnalytics.instance.setUserProperty(
|
|
107
|
+
name: 'favorite_food',
|
|
108
|
+
value: favoriteFood,
|
|
109
|
+
);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- Create custom definitions for user properties in the Analytics console before using them.
|
|
113
|
+
- Use user properties for custom definitions, report comparisons, or audience criteria.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 5. Best Practices
|
|
118
|
+
|
|
119
|
+
- **Request necessary permissions** before collecting user data, especially on platforms with strict privacy controls.
|
|
120
|
+
- **Never log** sensitive or personally identifiable information in events or user properties.
|
|
121
|
+
- Use **consistent naming conventions** for custom events and parameters.
|
|
122
|
+
- Group related events to track user flows and conversion funnels.
|
|
123
|
+
- **Test** your analytics implementation before deploying to production.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## References
|
|
128
|
+
|
|
129
|
+
- [FlutterFire GitHub Repository](https://github.com/firebase/flutterfire)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: firebase-app-check
|
|
3
|
+
description: Integrates Firebase App Check into Flutter apps. Use when setting up App Check, selecting providers per platform, using debug providers during development, enabling enforcement, or applying App Check security best practices.
|
|
4
|
+
intents: [security]
|
|
5
|
+
stacks: [flutter]
|
|
6
|
+
source: https://github.com/evanca/flutter-ai-rules
|
|
7
|
+
license: MIT
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Firebase App Check Skill
|
|
11
|
+
|
|
12
|
+
This skill defines how to correctly use Firebase App Check in Flutter applications.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
Use this skill when:
|
|
17
|
+
|
|
18
|
+
* Setting up and activating Firebase App Check in a Flutter project.
|
|
19
|
+
* Selecting the right provider for each platform.
|
|
20
|
+
* Configuring debug providers for development and testing.
|
|
21
|
+
* Enabling enforcement and monitoring App Check metrics.
|
|
22
|
+
* Applying App Check security best practices.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 1. Setup and Configuration
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
flutter pub add firebase_app_check
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```dart
|
|
33
|
+
import 'package:firebase_app_check/firebase_app_check.dart';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Initialize App Check **after** `Firebase.initializeApp()` and **before** using any Firebase services:
|
|
37
|
+
|
|
38
|
+
```dart
|
|
39
|
+
await Firebase.initializeApp();
|
|
40
|
+
await FirebaseAppCheck.instance.activate(
|
|
41
|
+
webProvider: ReCaptchaV3Provider('recaptcha-v3-site-key'),
|
|
42
|
+
providerAndroid: AndroidPlayIntegrityProvider(),
|
|
43
|
+
providerApple: AppleDeviceCheckProvider(),
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- Register your apps in the Firebase console under **Project Settings > App Check** before using the service.
|
|
48
|
+
- For web, obtain a reCAPTCHA v3 site key from the Firebase console.
|
|
49
|
+
- Consider setting a custom **TTL** for App Check tokens based on your security and performance needs — shorter TTLs are more secure but consume quota faster.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 2. Provider Selection
|
|
54
|
+
|
|
55
|
+
**Android:**
|
|
56
|
+
| Provider | Use case |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `AndroidPlayIntegrityProvider` | Production (default) |
|
|
59
|
+
| `AndroidDebugProvider` | Development / CI only |
|
|
60
|
+
|
|
61
|
+
**Apple (iOS / macOS):**
|
|
62
|
+
| Provider | Use case |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `AppleDeviceCheckProvider` | Production default (iOS 11+, macOS 10.15+) |
|
|
65
|
+
| `AppleAppAttestProvider` | Enhanced security (iOS 14+, macOS 14+) |
|
|
66
|
+
| `AppleAppAttestProviderWithDeviceCheckFallback` | App Attest with Device Check fallback |
|
|
67
|
+
| `AppleDebugProvider` | Development / CI only |
|
|
68
|
+
|
|
69
|
+
**Web:**
|
|
70
|
+
| Provider | Use case |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `ReCaptchaV3Provider` | Standard reCAPTCHA v3 |
|
|
73
|
+
| `ReCaptchaEnterpriseProvider` | Enhanced with additional features |
|
|
74
|
+
|
|
75
|
+
> **Android note:** For certain Android devices, enable "Meets basic device integrity" in the Google Play console to ensure proper App Check functionality.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 3. Development and Testing
|
|
80
|
+
|
|
81
|
+
Use debug providers during development to run in emulators or CI environments:
|
|
82
|
+
|
|
83
|
+
```dart
|
|
84
|
+
await FirebaseAppCheck.instance.activate(
|
|
85
|
+
providerAndroid: AndroidDebugProvider('YOUR_DEBUG_TOKEN'),
|
|
86
|
+
providerApple: AppleDebugProvider('YOUR_DEBUG_TOKEN'),
|
|
87
|
+
);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- **iOS:** Enable debug logging by adding `-FIRDebugEnabled` to Arguments Passed on Launch in Xcode.
|
|
91
|
+
- **Web:** Set `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;` in `web/index.html`.
|
|
92
|
+
- Register debug tokens shown in the console in the Firebase console's App Check section.
|
|
93
|
+
- **Never** use debug providers or share debug tokens in production builds.
|
|
94
|
+
- Keep debug tokens private — do not commit them to public repositories.
|
|
95
|
+
- Revoke compromised debug tokens immediately from the Firebase console.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 4. Enforcement and Monitoring
|
|
100
|
+
|
|
101
|
+
- **Monitor** App Check metrics before enabling enforcement to avoid disrupting legitimate users.
|
|
102
|
+
- Enable enforcement **gradually**, starting with non-critical Firebase services.
|
|
103
|
+
- Monitor request metrics for Realtime Database, Cloud Firestore, Cloud Storage, and Authentication.
|
|
104
|
+
- Once enforcement is enabled, only registered apps with valid App Check tokens can access Firebase resources.
|
|
105
|
+
- Use App Check **in combination with** Firebase Security Rules for comprehensive security.
|
|
106
|
+
- Implement proper error handling for App Check verification failures.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 5. Security Best Practices
|
|
111
|
+
|
|
112
|
+
- Never disable App Check in production builds once enabled.
|
|
113
|
+
- Implement a fallback mechanism for App Check verification failures.
|
|
114
|
+
- Regularly review App Check metrics to identify potential abuse patterns.
|
|
115
|
+
- App Check tokens are **automatically refreshed** at approximately half the TTL duration.
|
|
116
|
+
- For high-security applications, use the shortest practical TTL.
|
|
117
|
+
- Implement server-side verification for critical operations using the Firebase Admin SDK.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## References
|
|
122
|
+
|
|
123
|
+
- [Firebase App Check Flutter documentation](https://firebase.google.com/docs/app-check/flutter/default-providers)
|
|
124
|
+
- [Firebase App Check debug provider](https://firebase.google.com/docs/app-check/flutter/debug-provider)
|