From 90cbd7ab23b1a45d81df125e49b8f07ed4bf6476 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 16 Apr 2020 15:14:27 +0200 Subject: [PATCH] Fix issue with new API --- lib/helpers/search_helper.dart | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/helpers/search_helper.dart b/lib/helpers/search_helper.dart index 6f5d12c..36c5b2d 100644 --- a/lib/helpers/search_helper.dart +++ b/lib/helpers/search_helper.dart @@ -1,31 +1,24 @@ import 'package:comunic/helpers/users_helper.dart'; import 'package:comunic/lists/users_list.dart'; import 'package:comunic/models/api_request.dart'; -import 'package:comunic/utils/list_utils.dart'; +import 'package:comunic/utils/api_utils.dart'; /// Search helper /// /// @author Pierre HUBERT class SearchHelper { - /// Search for user. This method returns information about the target users /// /// Returns information about the target users or null if an error occurred Future searchUser(String query) async { // Execute the query on the server final response = await APIRequest( - uri: "user/search", - needLogin: true, - args: { - "query": query - } - ).exec(); + uri: "user/search", needLogin: true, args: {"query": query}).exec(); if (response.code != 200) return null; - return await UsersHelper().getUsersInfo( - listToIntList(response.getArray())); + return await UsersHelper() + .getUsersInfo(response.getArray().map((f) => cast(f)).toList()); } - -} \ No newline at end of file +}