FileObject class

File object that works across different providers

This class provides a unified interface for file objects from different providers (OpenAI, Anthropic, etc.) while maintaining backward compatibility.

Constructors

FileObject.new({required String id, required int sizeBytes, required DateTime createdAt, required String filename, String object = 'file', FilePurpose? purpose, FileStatus? status, String? statusDetails, String? mimeType, bool? downloadable, Map<String, dynamic>? metadata})
const
FileObject.fromAnthropic(Map<String, dynamic> json)
Create from Anthropic file format
factory
FileObject.fromOpenAI(Map<String, dynamic> json)
Create from OpenAI file format
factory

Properties

createdAt DateTime
The timestamp when the file was created.
final
downloadable bool?
Whether the file can be downloaded (may be null if not specified).
final
filename String
The name of the file.
final
hashCode int
The hash code for this object.
no setteroverride
id String
The file identifier, which can be referenced in the API endpoints.
final
metadata Map<String, dynamic>?
Provider-specific metadata that doesn't fit into standard fields.
final
mimeType String?
MIME type of the file (may be null if not provided).
final
object String
The object type, typically "file".
final
purpose FilePurpose?
The intended purpose of the file (may be null for providers that don't support it).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sizeBytes int
The size of the file, in bytes.
final
status FileStatus?
The current status of the file (may be null for providers that don't support it).
final
statusDetails String?
Additional details about the status of the file.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toAnthropicJson() Map<String, dynamic>
Convert to Anthropic format
toJson() Map<String, dynamic>
Generic JSON representation
toOpenAIJson() Map<String, dynamic>
Convert to OpenAI format for backward compatibility
toString() String
A string representation of this object.
override

Operators

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