Content class
Represents a message in a conversation (user or model turn).
Constructors
-
Content({required List<
Part> parts, String? role}) -
Creates a Content.
const
-
Content.fromJson(Map<
String, dynamic> json) -
Creates a Content from JSON.
factory
-
Content.fromParts(List<
Object> parts, {String role = 'user'}) -
Creates user content from multiple parts.
factory
-
Content.model(List<
Part> parts) -
Creates model-role content from parts.
const
- Content.text(String text)
-
Creates user content from a simple text string.
factory
-
Content.user(List<
Part> parts) -
Creates user-role content from parts.
const
Properties
Methods
-
copyWith(
{Object? role = unsetCopyWithValue, Object? parts = unsetCopyWithValue}) → Content - Creates a copy with replaced values.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts to JSON.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited