mirror of
https://github.com/foss42/apidash.git
synced 2025-09-22 04:53:32 +08:00
fix: PR fixes with few enhancements
This commit is contained in:
@ -1,12 +1,9 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:apidash/models/form_data_model.dart';
|
||||
import 'package:apidash/consts.dart';
|
||||
import 'package:apidash/models/models.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../consts.dart';
|
||||
import '../models/models.dart';
|
||||
|
||||
String humanizeDuration(Duration? duration) {
|
||||
if (duration == null) {
|
||||
return "";
|
||||
@ -113,16 +110,24 @@ List<FormDataModel>? listToFormDataModel(List? kvMap) {
|
||||
if (kvMap == null) {
|
||||
return null;
|
||||
}
|
||||
List<FormDataModel> finalRows = kvMap
|
||||
.map((formData) => FormDataModel(
|
||||
name: formData["name"],
|
||||
value: formData["value"],
|
||||
type: kMapFormDataType[formData["type"]] ?? FormDataType.text,
|
||||
))
|
||||
.toList();
|
||||
List<FormDataModel> finalRows = kvMap.map(
|
||||
(formData) {
|
||||
return FormDataModel(
|
||||
name: formData["name"],
|
||||
value: formData["value"],
|
||||
type: getFormDataType(formData["type"]),
|
||||
);
|
||||
},
|
||||
).toList();
|
||||
return finalRows;
|
||||
}
|
||||
|
||||
FormDataType getFormDataType(String? type) {
|
||||
List<FormDataType> formData = FormDataType.values;
|
||||
return formData.firstWhere((element) => element.name == type,
|
||||
orElse: () => FormDataType.text);
|
||||
}
|
||||
|
||||
Uint8List? stringToBytes(String? text) {
|
||||
if (text == null) {
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user