bind<T> method
Binds data from the request context to the given instance.
context - The context of the engine containing request data.
instance - The instance to which the data should be bound.
Implementation
@override
Future<T> bind<T>(
EngineContext context,
T instance, {
Map<String, String>? rules,
}) async {
final multipartForm = await context.multipartForm;
final data = multipartForm.fields;
if (instance is Map) {
for (final entry in data.entries) {
if (entry.value is MultipartFile) continue;
instance[entry.key] = entry.value;
}
} else if (instance is Bindable) {
instance.bind(data);
}
return instance;
}