PartMap class

Provides runtime metadata for a @Part annotation. Use this annotation to supply dynamic values like contentType or fileName that need to be determined at runtime rather than at compile time.

The parameter annotated with @PartMap should be a Map<String, dynamic> containing metadata for parts. Keys should be in the format:

  • 'partName_contentType' for content type
  • 'partName_fileName' for file name

Example:

@POST('/upload')
@MultiPart()
Future<Response> upload({
  @Part(name: 'file') required File file,
  @PartMap() Map<String, dynamic>? partMetadata,
});

// Usage:
api.upload(
  file: myFile,
  partMetadata: {
    'file_contentType': 'image/jpeg',
    'file_fileName': 'photo.jpg',
  },
);
Annotations
  • @immutable

Constructors

PartMap()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
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