isStructurallyValidMap static method
Returns true if body looks like a well-formed map payload, i.e. it
is a Map and every key is a non-empty String.
Implementation
static bool isStructurallyValidMap(dynamic body) {
if (body is! Map) return false;
for (final key in body.keys) {
if (key is! String || key.trim().isEmpty) return false;
}
return true;
}