refactor: avoid string conversion for comparison

This commit is contained in:
Lukas Lihotzki 2021-05-05 12:05:26 +02:00
parent 9de57fad9b
commit 4069f0a02f
1 changed files with 5 additions and 5 deletions

View File

@ -163,25 +163,25 @@ class MatrixApi {
http.Response resp;
var jsonResp = <String, dynamic>{};
try {
switch (describeEnum(type)) {
case 'GET':
switch (type) {
case RequestType.GET:
resp = await httpClient.get(url, headers: headers).timeout(
Duration(seconds: timeout),
);
break;
case 'POST':
case RequestType.POST:
resp =
await httpClient.post(url, body: json, headers: headers).timeout(
Duration(seconds: timeout),
);
break;
case 'PUT':
case RequestType.PUT:
resp =
await httpClient.put(url, body: json, headers: headers).timeout(
Duration(seconds: timeout),
);
break;
case 'DELETE':
case RequestType.DELETE:
resp = await httpClient.delete(url, headers: headers).timeout(
Duration(seconds: timeout),
);