shelf_multipart
2.0.2, released 3 weeks ago by simonbinder.eu
Parses multipart and form-data requests for shelf handlers.
What it does
shelf_multipart provides extension types and methods for shelf handlers to easily check for and parse multipart and multipart/form-data requests. It allows iterating over parts, reading part headers, and reading data as streams, bytes, or strings.
AI-written summary of version 2.0.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a backend using the shelf package
- You need to handle file uploads or multipart form data in Dart
Skip it when
- You are not using the shelf package for your server
- You only need to handle standard JSON or URL-encoded bodies
Strengths
- Provides type safety around multipart checks using extension types
- Easy iteration over request parts and form data parameters
- Integrates seamlessly with the shelf ecosystem
Weaknesses
- Limited to the shelf package ecosystem
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
not documented
Future<Response> myHandler(Request request) async {
if (request.multipart() case var multipart?) {
await for (final part in multipart.parts) {
final headers = part.headers;
}
} else {
return Response(401);
}
}Alternatives
Packages that do the same job and could replace shelf_multipart.
- shelf_web_socket
Shelf handler that upgrades HTTP to WebSocket and provides a WebSocketChannel per connection.
80Compare - graphql_codegen
Generate Dart serializers and client helpers from GraphQL queries and schemas.
78Compare - chucker_flutter
Inspect HTTP(S) requests, responses, and network traffic with a built-in UI and local storage.
78Compare - shelf_enforces_ssl
Middleware that blocks non-HTTPS requests to a Shelf or Dart Frog server.
43Compare
Works with
Packages commonly used together with shelf_multipart: ones it builds on, ones built on it, and its own family.
- mimeshelf_multipart depends on itUtilities to resolve MIME types from file names, magic bytes, and to parse multipart streams.
- shelfshelf_multipart depends on itComposable web server middleware for Dart
- string_scannershelf_multipart depends on itA class for parsing strings using a sequence of patterns.
- http_parsershelf_multipart depends on itA platform-independent package for parsing and serializing HTTP formats.
- shelf_easyBuilt on shelf_multipartLightweight framework with a JSON model generator, database operator, and web/WebSocket server/client.
- vadenBuilt on shelf_multipartA Dart backend framework inspired by Spring Boot, using annotations for controllers, DI, and OpenAPI docs.
- json_rest_serverBuilt on shelf_multipartA RESTful server based on JSON With this package you can have a fully functional RESTful server with auth, pagination and all the necessaries services do build an application