flutter-conventions_skill

This skill applies Dart and Flutter conventions, naming, structure, and async/await best practices to improve code clarity and maintainability.
  • Shell

6

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill kaakati/rails-enterprise-dev --skill flutter-conventions

  • SKILL.md3.9 KB

Overview

This skill captures Dart 3.x and Flutter 3.x conventions and pragmatic best practices for naming, file layout, null safety, async patterns, and widget/code organization. It condenses idiomatic patterns that reduce runtime errors, improve readability, and scale across feature- or layer-based architectures. Use it to standardize teams and accelerate code reviews and onboarding.

How this skill works

It inspects and prescribes naming conventions (snake_case files, PascalCase classes, camelCase members), directory organization (layer-first and feature-first examples), and file-level ordering (constants, static, fields, constructors, lifecycle, public/private methods). It highlights Dart 3 features like pattern matching, records, and sealed classes and provides concrete guidance for null safety and async/await usage including parallel tasks and fire-and-forget calls.

When to use it

  • When setting up a new Flutter project and choosing a project structure.
  • During code reviews to enforce naming, file layout, and widget rules.
  • When migrating to Dart 3.x features (pattern matching, records, sealed classes).
  • To reduce null-safety bugs and standardize use of late, ?, !, and ?? operators.
  • When optimizing asynchronous flows and parallelizing network/database calls.

Best practices

  • Name files snake_case.dart, classes PascalCase, and use camelCase for variables and functions.
  • Prefer layer-first for Clean Architecture; use feature-first for smaller cross-cutting features.
  • Use late for fields initialized in lifecycle hooks, ? for nullable types, and avoid ! except when provably safe.
  • Favor async/await with try/catch for readable error handling; use Future.wait for parallel calls and unawaited for fire-and-forget.
  • Keep widgets immutable where possible: prefer const constructors and extract reusable widgets.
  • Organize class members consistently: constants, static, instance fields, constructors, getters/setters, lifecycle, public, private.

Example use cases

  • Creating a new app scaffold that enforces filename and directory standards for team consistency.
  • Refactoring controllers to follow null-safety best practices and lifecycle initialization with late fields.
  • Converting multiple sequential network calls into Future.wait to speed startup data loading.
  • Defining domain responses with sealed classes and using pattern matching to simplify state handling.
  • Extracting repeated UI into const widgets and small private builders for performance and testability.

FAQ

Use layer-first for strict Clean Architecture and large apps that separate domain/data/presentation; choose feature-first when features are independent and you want encapsulated folders per feature.

How do I decide between late and nullable fields?

Use late when a non-nullable field is guaranteed to be initialized before use (e.g., in onInit). Use nullable types when absence is valid and provide defaults with ?? where appropriate.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational