example_gen library
Classes
- BoolExample
- DateRange
- Date range (DateTime)
- DateTimeExample
- DoubleExample
- Email constraint with domain and length control
-
EnumHint<
T> - Enum preference
- Example
- Fixed example value (highest priority)
- ExampleContext
- Unified "example generation context"
- ExampleModel
- Marks a model that needs example code generation.
- ExampleRegistry
- Runtime registry (code generators will call basic type generation)
- FieldDescription
- For documentation only (notes in preview structure)
- IntExample
- Items
- Collection size (List/Set/Map)
- Len
- String length
- Nullable
- Nullable probability (0~1), only applies to nullable fields
- OneOf
- Candidate set
- Range
- Numeric range
- StringExample
- Basic type default generation
-
TypeExample<
T> - Runtime type generator interface (for basic types and extensible hooks)
- UUID
- UUID constraint for generating UUID strings
Functions
-
registerBuiltins(
) → void - Register built-ins
-
seedFor(
String path, int baseSeed) → int - Stable hash (for "field path + baseSeed → sub-seed")
-
toPreviewJson(
Map< String, dynamic> json, {String rootName = 'root'}) → String - Convert JSON Map to structure preview JSON string (for UI tree rendering) This does not contain annotation info (that part is better handled by generated code injecting constraints when building example JSON)