Reputation: 43
I've created a simple flutter app to tell me the weather using a weather API and the HTTP package. The app runs as intended on my emulated device and for testing, on a physical device, I built a fat apk using `flutter build ask. Unfortunately, the app doesn't go past the loading screen on physical devices(I've tested it on multiple devices).
android manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="co.appbrewery.clima">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
loading screen
import 'package:clima/services/weather.dart';
import 'package:flutter/material.dart';
import 'location_screen.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
class LoadingScreen extends StatefulWidget {
@override
_LoadingScreenState createState() => _LoadingScreenState();
}
class _LoadingScreenState extends State<LoadingScreen> {
@override
void initState() {
super.initState();
getlocationdata();
}
void getlocationdata() async {
WeatherModel weatherModel = WeatherModel();
var weatherdata = await weatherModel.getlocationweather();
Navigator.push(context, MaterialPageRoute(builder: (context) {
return LocationScreen(
locationweather: weatherdata,
);
}));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SpinKitChasingDots(
color: Colors.white,
size: 50,
),
),
);
}
}
What's going wrong? I'm stuck. Any help would be appreciated!
Upvotes: 0
Views: 398
Reputation: 1
You can process like that :
Comment the line with getlocationdata();
Then run with flutter run
If it work, look in debug mode why that doesn't work.
If it still not work, so try to replace the SpinKitChasingDots
by Text("test")
.
Good luck
Upvotes: 0