I'm trying to run my Flutter app on my own smartphone. Everything is working fine but my smartphone can't connect to the API.
My local API is running on http://127.0.0.1:8000 (Laravel backend).
Future<List<Job>> fetchJobs() async {
  final response = await http.get(Uri.parse('http://10.0.2.2:8000/api/jobs'));
  if (response.statusCode == 200) {
    List jsonResponse = json.decode(response.body);
    return jsonResponse.map((data) => Job.fromJson(data)).toList();
  } else {
    throw Exception('Failed to load jobs');
  }
}
I'm using http://10.0.2.2:8000 because my app is currently running on an Android Emulator in Android Studio.
Now I've got the following error wenn I use my app on my smartphone:
The following LateError was thrown while handling a gesture: LateInitializationError: Field '_allUsers@32500082' has not been initialized.
My smartphone is connected to same network as my PC, I already checked this. I also tried to replace 10.0.2.2 with my private IPv4 from my PC but this doesn't work neither.
What can I do to solve this problem?
 
    