MediaItem class
MediaItem - Represents a media asset (image, video, etc.)
Used in product galleries and anywhere media needs to be displayed
Constructors
-
MediaItem({required String url, String type = 'image', String? thumbnail, String? alt, Map<
String, dynamic> ? metadata}) -
const
-
MediaItem.fromJson(Map<
String, dynamic> json) -
factory
- MediaItem.fromUrl(String url, {String type = 'image'})
-
Create a MediaItem from a simple URL string (defaults to image type)
factory
Properties
- alt → String?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
metadata
→ Map<
String, dynamic> ? -
final
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true, thetoStringmethod will be overridden to output this instance'sprops.no setterinherited - thumbnail → String?
-
final
- type → String
-
final
- url → String
-
final
Methods
-
copyWith(
{String? url, String? type, String? thumbnail, String? alt, Map< String, dynamic> ? metadata}) → MediaItem -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
detectTypeFromUrl(
String url) → String - Helper to detect media type from URL extension