From 4069f0a02f5461bc7ae0ba7cdb2f5eda224173cb Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Wed, 5 May 2021 12:05:26 +0200 Subject: [PATCH] refactor: avoid string conversion for comparison --- lib/src/matrix_api.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/matrix_api.dart b/lib/src/matrix_api.dart index d32e3524..4d623a0e 100644 --- a/lib/src/matrix_api.dart +++ b/lib/src/matrix_api.dart @@ -163,25 +163,25 @@ class MatrixApi { http.Response resp; var jsonResp = {}; 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), );