I watched this tutorial but im stuck in return of future list https://www.youtube.com/watch?v=lTKFYGHx16M trying to connect mysql php api and flutter code
import '../model/usersdata.dart';
import 'package:http/http.dart' as http;
Future<List<Userprofile>> fetchUsers() async {
var url = Uri.parse("http://192.168.100.68/mlm_sys/api_request/get_data.php");
final response = await http.get(url);
print(response.body);
return userprofileFromJson(response.body);<----ERROR LINE
ERROR: //A value of type 'Userprofile' can't be returned from the function 'fetchUsers' because it has a return type of 'Future<List>'. }
///=====MODEL
import 'dart:convert';
Userprofile userprofileFromJson(String str) =>
Userprofile.fromJson(json.decode(str));
String userprofileToJson(Userprofile data) => json.encode(data.toJson());
class Userprofile {
Userprofile({
required this.id,
required this.sponsor,
required this.fname,
required this.lname,
required this.mname,
required this.pnum,
required this.address,
required this.email,
required this.username,
required this.password,
required this.dateRegistration,
});
........AND SO ON
fetchUsers()function