getValidatedBody
Result<
Get validated body from request (use after validateBody middleware)
Implementation
Result<T, String> getValidatedBody<T>(Request req) {
final value = req[_validatedBodyKey]?.dartify();
return switch (value) {
final T v => Success(v),
_ => const Error(
'No validated body found. Did you use validateBody middleware?',
),
};
}