import 'dart:convert'; import 'package:contacts_plus_plus/api_client.dart'; import 'package:contacts_plus_plus/models/user.dart'; class UserApi { static Future> searchUsers(ApiClient client, {required String needle}) async { final response = await client.get("/users?name=$needle"); ApiClient.checkResponse(response); final data = jsonDecode(response.body) as List; return data.map((e) => User.fromMap(e)); } }