mirror of
https://github.com/foss42/apidash.git
synced 2025-05-28 12:18:06 +08:00
wip: added basic methods
This commit is contained in:
@ -1,7 +1,10 @@
|
||||
import 'dart:typed_data';
|
||||
import 'dart:convert';
|
||||
import '../models/models.dart';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:apidash/models/form_data_model.dart';
|
||||
|
||||
import '../consts.dart';
|
||||
import '../models/models.dart';
|
||||
|
||||
String humanizeDuration(Duration? duration) {
|
||||
if (duration == null) {
|
||||
@ -78,6 +81,17 @@ Map<String, String>? rowsToMap(List<NameValueModel>? kvRows,
|
||||
return finalMap;
|
||||
}
|
||||
|
||||
Map<String, String>? rowsToFormDataMap(
|
||||
List<FormDataModel>? kvRows,
|
||||
) {
|
||||
if (kvRows == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> finalMap = {};
|
||||
for (var row in kvRows) {}
|
||||
return finalMap;
|
||||
}
|
||||
|
||||
List<NameValueModel>? mapToRows(Map<String, String>? kvMap) {
|
||||
if (kvMap == null) {
|
||||
return null;
|
||||
@ -89,6 +103,21 @@ List<NameValueModel>? mapToRows(Map<String, String>? kvMap) {
|
||||
return finalRows;
|
||||
}
|
||||
|
||||
List<FormDataModel>? mapToFormRows(Map<String, String>? kvMap) {
|
||||
if (kvMap == null) {
|
||||
return null;
|
||||
}
|
||||
List<FormDataModel> finalRows = [];
|
||||
for (var k in kvMap.keys) {
|
||||
finalRows.add(FormDataModel(
|
||||
name: k,
|
||||
value: kvMap[k],
|
||||
type: FormDataType.text,
|
||||
));
|
||||
}
|
||||
return finalRows;
|
||||
}
|
||||
|
||||
Uint8List? stringToBytes(String? text) {
|
||||
if (text == null) {
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user