add-product-flow

Documents the Flutter Add Product flow's files, state patterns, bugs, and interaction rules.

Updated Mar 9, 2026
One-click install
npx skills add https://github.com/yunior123/origna_gta_firebase --skill add-product-flow-yunior123
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: add-product-flow
Source: https://github.com/yunior123/origna_gta_firebase/tree/main/.claude/skills/add-product-flow
Command: npx skills add https://github.com/yunior123/origna_gta_firebase --skill add-product-flow-yunior123

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Editing the Add Product feature without full context causes regressions like broken image sync, shipping toggle conflicts, and double-submits. This Skill loads deep knowledge of the flow's files, state management patterns, fixed bugs, and interaction rules before any code change. ## Core Features & Use Cases - File Map: Lists the four core files (state, viewmodel, image picker, main screen) with roles and sizes. - Bug & Pattern Reference: Documents the sentinel copyWith pattern, image sync callback requirement, and free shipping cascade logic. - Interaction Matrix: Defines how digital, free shipping, and local delivery toggles disable or force other shipping options. - Use Case: Before modifying addproduct_screen.dart, load this Skill to learn that postal codes must be normalized before regex validation and that double.tryParse must replace double.parse in submit logic. ## Quick Start Load the add-product-flow skill before editing any file in the Flutter add product feature.

Frequently Asked Questions about add-product-flow

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

FAQPage Schema
How do I fix nullable fields being cleared in Dart copyWith?▼

Use the sentinel copyWith pattern: define a private sentinel Object and default each nullable parameter to it, then only overwrite the field when the parameter differs from the sentinel. This skill applies it to errorMessage, latitude, and longitude in AddProductState.

Why does image validation fail after picking images in Flutter?▼

The ProductAddImages StatefulWidget keeps local _imageModels state, so the ViewModel's state.imageModels stays empty unless the onImagesChanged callback fires after every pick or remove. Also use Image.memory with the non-nullable Uint8List bytes, never Image.network, for local picker images.

How does free shipping interact with express and same-day delivery options?▼

Enabling free shipping forces expressEnabled, sameDayEnabled, and freeShippingAt10Plus off because the backend zeroes all shipping tiers. Digital products force freeShipping=true and block unchecking, while local delivery only disables standard, express, and same-day options.

How do I prevent double submission on a Flutter form button?▼

Guard the submit method with an early return when state.isLoading is true, placed at the top of addProduct(). This blocks duplicate product creation while the async create operation is in flight.

What validation gotchas exist in the add product submit flow?▼

Use double.tryParse with a fallback instead of double.parse to avoid crashes, normalize postal codes by removing spaces before the Canadian regex, and call clearCoordinates() when street, city, or postal code is manually edited to avoid stale geolocation.