core/constants/ — Application Constants

Centralize Flutter client constants for API endpoints, routes, and storage keys.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/Vantoan252003/Mozi --skill core-constants-application-constants
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: core/constants/ — Application Constants
Source: https://github.com/Vantoan252003/Mozi/tree/main/lib/core/constants
Command: npx skills add https://github.com/Vantoan252003/Mozi --skill core-constants-application-constants

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralizes all string literals and numeric configuration values used across the Flutter client to eliminate magic strings, reduce duplication, and make refactors and testing safe and predictable.

Core Features & Use Cases

  • API endpoint catalog: central list of relative HTTP paths with {id} placeholders for dynamic segments so network code never hardcodes routes.
  • Routing paths: go_router path constants with :param notation for consistent navigation and deep linking.
  • Client configuration and keys: app-level timeouts, page sizes, Hive box names, secure storage keys, and socket event names as immutable static constants.
  • Use Case: When adding a new backend endpoint and its UI route, update api_constants.dart and route_constants.dart to ensure the entire codebase references the same values.

Quick Start

Add a new endpoint by editing api_constants.dart and declare the path as a static const string using {id} placeholders for dynamic segments.

Frequently Asked Questions about core/constants/ — Application Constants

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage Flutter API endpoints and routing paths without magic strings?

To manage Flutter API endpoints and routing paths without magic strings, use a centralized constants file declaring static const strings. This ensures network and UI layers reference immutable values, eliminating duplication and inconsistent route definitions across modules.

What is the best way to structure Hive storage keys and socket events in a Flutter app?

The best way to structure Hive storage keys and socket events is grouping them as static constants in a dedicated configuration file. Centralizing these app-level values prevents magic strings, making refactors and testing safe and predictable across your Flutter client.

How do I add a new backend endpoint to a Flutter client configuration?

To add a new backend endpoint, edit your api_constants.dart file and declare the path as a static const string. Use relative paths with {id} placeholders for dynamic segments, ensuring the base URL remains excluded from the constant definition.

Can I use go_router param syntax inside Flutter route constants?

Yes, you can use go_router :param syntax inside Flutter route constants. Declaring paths with this notation as static constants ensures consistent navigation and deep linking, allowing UI layers to reference exact routing values without hardcoding strings.

Why should I not include runtime logic inside Flutter configuration files?

You should not include runtime logic inside Flutter configuration files to maintain deterministic behavior. Keeping constant files limited to static const declarations ensures the application constants remain a single, predictable source of truth during refactoring and testing.