Frontend · Claude Code (via permissions.deny)
Flutter 3 & Riverpod / Dart .claudeignore
A .claudeignore for Flutter 3 & Riverpod / Dart: the paths Claude Code should stay out of, with matching permissions.deny rules.
- Path
- .claudeignore
- Loads
- Pattern list
- Format
- gitignore syntax
- Used by
- Claude Code (via permissions.deny)
What this file tells the agent
Claude Code reads files while it works. This .claudeignore keeps the list of Flutter 3 & Riverpod / Dart paths it should stay out of (build output, large binaries, logs and secrets). Copy the sensitive ones into permissions.deny in .claude/settings.json, which Claude Code enforces.
- Always add const constructors wherever possible to maximize Flutter element rebuild caching.
- Use Riverpod 3 with code generation (@riverpod, Notifier/AsyncNotifier) or BLoC; ban raw mutable setState() in business logic.
- Leverage Dart 3 pattern matching and sealed classes for exhaustive state and error representation.
- Enforce sound null safety: avoid force-unwrapping with ! unless proven non-null by a preceding guard clause.
- Separate presentation UI widgets from asynchronous repository and API service layers.
Code to avoid, and what to write instead
The rule steers the agent away from the left and toward the right.
// Discouraged: Mutable setState with force-unwrap and missing const
class BadProfile extends StatefulWidget {
@override
_BadProfileState createState() => _BadProfileState();
}
class _BadProfileState extends State<BadProfile> {
var user;
void load() async {
user = await fetchUser();
setState(() {});
}
@override
Widget build(BuildContext context) {
return Container(child: Text(user!.name)); // Runtime crash if null!
}
}import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@immutable
sealed class ViewState<T> {
const ViewState();
}
class Loading<T> extends ViewState<T> { const Loading(); }
class Success<T> extends ViewState<T> { final T data; const Success(this.data); }
class Failure<T> extends ViewState<T> { final String message; const Failure(this.message); }
class ProfileView extends ConsumerWidget {
const ProfileView({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(profileProvider);
return Scaffold(
appBar: AppBar(title: const Text('Profile')),
body: switch (state) {
Loading() => const Center(child: CircularProgressIndicator.adaptive()),
Success(:final data) => Center(child: Text('Welcome, ${data.name}')),
Failure(:final message) => Center(child: Text('Error: $message')),
},
);
}
}Install it in one command
- 01
Go to your project root
The file goes at .claudeignore, relative to the root.
- 02
Download the file
Run the command on the right. It downloads this preset and writes the file.
- 03
Make sure it gets used
Claude Code does not enforce .claudeignore by itself. Copy the sensitive paths into permissions.deny in .claude/settings.json, which it does enforce.
$ curl -fsSL "https://www.devscratchpad.tech/api/raw/claudeignore/flutter-dart" -o ".claudeignore"
writes .claudeignore
.claudeignore
To write the file from your own code instead, use Read your code or Convert Legacy Rules in the editor above.
More for Flutter 3 & Riverpod / Dart
Questions
- Does Claude Code honor .claudeignore?
- Not by itself. Claude Code enforces permission rules, so copy the sensitive paths into permissions.deny in .claude/settings.json, for example Read(./.env). Keep .claudeignore in the repository root as the reviewable list.
- What should I put in .claudeignore?
- Exclude large build caches, minified bundles, lockfiles, and environment files containing sensitive credentials.