i want to use multiple parametres for restful api in flutter.
i can get data by id but i want to get data by id and userId.
how could i do?
class NetworkService {
Future<List<dynamic>> fetchData(int id) async {
final response = await http.get(Uri.parse
("https://jsonplaceholder.typicode.com/posts?id=$id"));
if (response.statusCode == 200) {
return jsonDecode(response.body);
} else {
print("Failed to load data");
}
}
}
2
Answers
You could do this
Try the following