Skip to main content
LarpLand uses strongly-typed data models to represent entities in the application. All models include JSON deserialization with robust type coercion.

User

Represents a registered user in the system. Source: lib/model/user.dart:1
FieldTypeDescription
idintUnique user identifier
nameStringUser’s display name
emailStringUser’s email address
Factory Method:
  • User.fromJson(Map<String, dynamic> json) - Creates a User instance from JSON data

Product

Represents a product available for purchase in the marketplace. Source: lib/model/product.dart:1
FieldTypeDescription
idintUnique product identifier
nombreStringProduct name
descripcionStringProduct description
precioStringProduct price (as string for formatting)
imagenStringProduct image URL
cantidadintAvailable stock quantity
valoracionTotalStringOverall product rating
categoriaStringProduct category
cantidadCarritointQuantity in shopping cart (default: 1)
Factory Method:
  • Product.fromJson(Map<String, dynamic> json) - Creates a Product instance from JSON data with field validation

RoleplayEvent

Represents a roleplay event that users can register for. Source: lib/model/roleplay_event.dart:1
FieldTypeDescription
idintUnique event identifier
nameStringEvent name
descriptionStringEvent description
fechaInicioStringEvent start date/time (ISO 8601 string)
fechaFinStringEvent end date/time (ISO 8601 string)
isRegisteredboolWhether the current user is registered (default: false)
Factory Method:
  • RoleplayEvent.fromJson(Map<String, dynamic> json) - Creates a RoleplayEvent from JSON, supporting both Spanish and English field names

UserOrder

Represents a customer order with line items. Source: lib/model/order.dart:1
FieldTypeDescription
idintUnique order identifier
userIdintID of the user who placed the order
totalAmountdoubleTotal order amount
totalItemsintTotal number of items in order
statusStringOrder status (e.g., “completed”, “pending”)
createdAtDateTime?Order creation timestamp
itemsList<UserOrderItem>Line items in the order
Factory Method:
  • UserOrder.fromJson(Map<String, dynamic> json) - Creates a UserOrder from JSON with nested items

UserOrderItem

Represents a single line item within an order. Source: lib/model/order.dart:57
FieldTypeDescription
productIdintID of the ordered product
productNameStringName of the ordered product
unitPriceStringPrice per unit
quantityintQuantity ordered
lineTotaldoubleTotal for this line (unitPrice × quantity)
imageUrlStringProduct image URL
Factory Method:
  • UserOrderItem.fromJson(Map<String, dynamic> json) - Creates a UserOrderItem from JSON with default values

ProductReviews

Represents a user review for a product. Source: lib/model/user_review.dart:1
FieldTypeDescription
idintUnique review identifier
userIdintID of the user who wrote the review
productIdintID of the reviewed product
ratingintStar rating (typically 1-5)
commentStringReview text
createdAtDateTime?Review creation timestamp
Factory Method:
  • ProductReviews.fromJson(Map<String, dynamic> json) - Creates a ProductReviews instance from JSON

Login

Represents a login response with user authentication details. Source: lib/model/login.dart:1
FieldTypeDescription
statusStringLogin status (“success” or “error”)
rolintUser role/permission level
messageStringStatus message
userIdintAuthenticated user’s ID
tokenString?Authentication token (optional)
Factory Method:
  • Login.fromJson(Map<String, dynamic> json) - Creates a Login instance from JSON, supporting multiple token field names and nested payload structures
All models include robust type coercion in their fromJson methods, converting between int, num, String, and other types as needed to handle varied JSON structures.

Build docs developers (and LLMs) love