Add the functionality to import a curl file into the app.

The user can click on the button saying "+ Import" after which, they
will be allow to drop a curl file and import the curl command in the
app.
This commit is contained in:
Ketan Sonar
2024-07-04 23:35:59 +05:30
parent 063638b8ef
commit 7720611cd7
8 changed files with 180 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import 'dart:typed_data';
import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../models/models.dart';
import '../consts.dart';
import 'package:http/http.dart' as http;
@ -179,3 +180,22 @@ List<NameValueModel>? getEnabledRows(
rows.where((element) => isRowEnabledList[rows.indexOf(element)]).toList();
return finalRows == [] ? null : finalRows;
}
HTTPVerb? httpVerbFromString(String value) {
switch (value) {
case "GET":
return HTTPVerb.get;
case "POST":
return HTTPVerb.post;
case "PUT":
return HTTPVerb.put;
case "DELETE":
return HTTPVerb.delete;
case "HEAD":
return HTTPVerb.head;
case "PATCH":
return HTTPVerb.patch;
default:
return null;
}
}