payloadFor method
Builds a submission payload from the schema's declared field names, not
from _values's keys — the client-side mirror of the server's "no rule,
no validated key, no write". A key the schema does not declare, however
it got into the value map, can never reach the server this way.
A name is included only when it is genuinely writable: not hidden, not
disabled, and not a read-only FileComponent — a multiple (or
gated) file field the server marked readOnly still has nowhere for a
client-sent value to go, so submitting one is noise at best. A
single-file field the server left writable is different: by the time a
submit happens its value, if set, is already the path /upload
returned (see ResourceFormProvider.uploadFile), and the server
expects that path in the payload like any other field.
A dotted name is a path, not a literal key: Laravel validates
title.ar against title[ar], and a translatable Filament field is
published with exactly that name. Sending {"title.ar": …} flat makes
every such field read as absent, so a filled form comes back 422
"required" on the fields the user just typed into.
Implementation
Map<String, dynamic> payloadFor(List<SchemaComponent> components) {
final payload = <String, dynamic>{};
for (final field in writableFields(components)) {
_writePath(payload, field.name!, _values[field.name!]);
}
return payload;
}