Product class

Example 2: Product with Metadata Shows how to store product variants and SEO data

Annotations
  • @AckModel.new(description: 'Product with flexible metadata', additionalProperties: true, additionalPropertiesField: 'metadata')

Constructors

Product({required String id, required String name, required double price, Map<String, dynamic> metadata = const {}})

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
final
metadata Map<String, dynamic>
This field stores extra data like brand, color, warranty, etc.
final
name String
final
price double
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited