internalSubmit method
Submits the form.
Implementation
Future<void> internalSubmit(Element? buttonElement) async {
// Get method
var method = (this.method ?? 'get').toLowerCase();
if (method == '') {
method = 'get';
}
// Get URI
var uriString = _getFormAction(buttonElement!) ?? '';
if (uriString.isEmpty) {
uriString = baseUri!;
}
final uri = Uri.parse(uriString);
switch (uri.scheme) {
case 'http':
break;
case 'https':
break;
default:
return;
}
// Open HTTP request
final encType = enctype?.toLowerCase();
switch (encType ?? '') {
case '':
await _sendUrlEncoded(method, uri);
break;
case 'multipart/form-data':
await _sendMultiPart(uri);
break;
case 'application/x-www-form-urlencoded':
await _sendUrlEncoded(method, uri);
break;
default:
throw StateError('Unsupported encoding type: "$encType"');
}
}