londonappbrewery / clima-flutter-completed Goto Github PK
View Code? Open in Web Editor NEWThe completed code for the Clima Project - The Complete Flutter Development Bootcamp
Home Page: https://www.appbrewery.co/
The completed code for the Clima Project - The Complete Flutter Development Bootcamp
Home Page: https://www.appbrewery.co/
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building LocationScreen(dirty, state:
_LocationScreenState#8c194):
A non-null String must be provided to a Text widget.
'package:flutter/src/widgets/text.dart':
Failed assertion: line 360 pos 10: 'data != null'
The relevant error-causing widget was:
LocationScreen
file:///G:/app%20brewery%20flutter/savd%20projects/weather_forcasting_app/lib/screens/loading_screen.dart:26:15
When the exception was thrown, this was the stack:
#2 new Text (package:flutter/src/widgets/text.dart:360:10)
#3 _LocationScreenState.build (package:weather_forcasting_app/screens/location_screen.dart:103:21)
#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4663:28)
#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4546:15)
#6 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#7 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#8 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4525:5)
#9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4710:11)
#10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
... Normal element mounting (132 frames)
#142 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
#143 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
#144 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5624:32)
#145 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6001:17)
#146 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#147 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#148 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#149 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#150 StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#151 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#152 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#153 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#154 ProxyElement.update (package:flutter/src/widgets/framework.dart:4906:5)
#155 _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:183:11)
#156 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#157 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#158 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#159 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#160 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#161 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#162 StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#163 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#164 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#165 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#166 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#167 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#168 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#169 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#170 StatelessElement.update (package:flutter/src/widgets/framework.dart:4627:5)
#171 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#172 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#173 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#174 ProxyElement.update (package:flutter/src/widgets/framework.dart:4906:5)
#175 Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#176 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#177 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#178 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#179 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2667:33)
#180 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:866:20)
#181 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
#182 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
#183 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1056:9)
#184 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:972:5)
#188 _invoke (dart:ui/hooks.dart:253:10)
#189 _drawFrame (dart:ui/hooks.dart:211:3)
(elided 5 frames from class _AssertionError and dart:async)
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building LocationScreen(dirty, state: _LocationScreenState#8c194):
A non-null String must be provided to a Text widget.
'package:flutter/src/widgets/text.dart':
Failed assertion: line 360 pos 10: 'data != null'
The relevant error-causing widget was:
LocationScreen file:///G:/app%20brewery%20flutter/savd%20projects/weather_forcasting_app/lib/screens/loading_screen.dart:26:15
When the exception was thrown, this was the stack:
#2 new Text (package:flutter/src/widgets/text.dart:360:10)
#3 _LocationScreenState.build (package:weather_forcasting_app/screens/location_screen.dart:103:21)
#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4663:28)
#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4546:15)
#6 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
i need help
when i disable gps and start the app stays in loading screen and don't move to location screen with null proprieties.
in the tutorial the code didnt work for me so i used this instead import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
class LoadingScreen extends StatefulWidget {
@OverRide
_LoadingScreenState createState() => _LoadingScreenState();
}
class _LoadingScreenState extends State {
Future getCurrentPosition() async {
// Check if the location service is enabled
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
print("Location service enabled: $serviceEnabled");
if (!serviceEnabled) {
return Future.error("Location service is not enabled.");
}
// Check if the location permission is granted
LocationPermission status = await Geolocator.checkPermission();
print("Location permission: $status");
if (status == LocationPermission.denied) {
// Request the location permission
status = await Geolocator.requestPermission();
if (status == LocationPermission.denied) {
// Permission is not granted, return an error message
return Future.error("Location permission not granted.");
}
}
// Get the current position if the location permission is granted
Position position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
print(position);
return position;
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () {
getCurrentPosition();
},
child: Text('Get Location'),
),
),
);
}
}
just clone this repo and run on android studio and run into following error.
Note: C:\src\flutter\flutter.pub-cache\hosted\pub.dartlang.org\permission_handler-3.3.0\android\src\main\java\com\baseflow\permissionhandler\PermissionHandlerPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
and followed by built with 401 response code .
it shows the error handling message given to it
but when I type the city name. it shows the correct weather.
The only error is when I click on the navigation button (get current navigation)
App working fine on android emulator but when created APK to install in phone then the app gets stuck on loading screen forever.
Assertion failed: file:///C:/Users/User/flutter/packages/flutter/lib/src/widgets/navigator.dart:5307:12
!_debugLocked
is not true
Does anyone know why this happens?
I did all the steps right but still it crashes after it loads.
After build the apk and try to open it on phone, it stuck on the loading Screen, on console I get this error-
" E/flutter (21270): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: SocketException: Failed host lookup: 'api.openweathermap.org' (OS Error: No address associated with hostname, errno = 7)
E/flutter (21270): "
I checked the internet and added these 2 line manually-
uses-permission android:name="android.permission.INTERNET"
uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
I already gave the permission to the app to access the internet on my phone. But still no luck. I checked the Api link- it's perfect on issue on it.
Any solution??
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following _TypeError was thrown building Builder:
type 'int' is not a subtype of type 'double'
The relevant error-causing widget was:
MaterialApp file:///D:/Clients/experiments/Clima-Flutter/lib/main.dart:9:12
When the exception was thrown, this was the stack:
#0 _LocationScreenState.updateUI.<anonymous closure> (package:clima/screens/location_screen.dart:36:14)
#1 State.setState (package:flutter/src/widgets/framework.dart:1233:30)
#2 _LocationScreenState.updateUI (package:clima/screens/location_screen.dart:28:5)
#3 _LocationScreenState.initState (package:clima/screens/location_screen.dart:24:5)
#4 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4640:58)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
Please help
when i run the app, build failed with this exception ::
FAILURE: Build failed with an exception.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.google.gms:google-services:4.2.0.
Required by:
project :
> Could not resolve com.google.gms:google-services:4.2.0.
The app starts with home page of loading screen and then navigates to location_screen.dart file. however, if you press the back button, it shows the loading screen which is endless and may make the user think that the app has crashed. One option is to put loading screen inside a widget rather than dart file or having double press back button to close the app but as a beginner, I do not know how to do it. i looked on stackoverflow but did not find any good answer.
when i try to run the app it shows this error "Int is not subtype of double" idk what to do
hi i got this error when try to get the location
i followed the code thil the end even i compare it with original completed project clima from london appbrewery
still didnt work . . u can see the following picture above even i ran it on the physical device . . from the picture u can see also that means it throw a same error (null value) didnt catch location properly. .
Hi this isn't really an issue but can i get samples on how to form the custom variable for the weatherMessage and cityName texts displayed after you create an exception to catch and check if the weatherData displays a null so as to display a different text.
I hope y'all get what I mean
type 'int' is not a subtype of type double this error coming
Hi Everyone,
If you are trying to run this app on android emulator during development and stuck on loading screen or didn't get location data from geolocator package please follow below issue link:
For dynamically changing the content of the location screen use set state() for getting weather details city wise
FlatButton(
onPressed: () async {
//WeatherModel modelx1 = WeatherModel();
var weatherData = await model.getlocationweather();
setState(() {
updateUI(weatherData);
});
},
child: Icon(
Icons.near_me,
size: 30.0,
),
),
The relevant error-causing widget was:
Column file:///D:/FlutterApps/Clima-Flutter-master/lib/screens/location_screen.dart:60:18
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.
The specific RenderFlex in question is: RenderFlex#d8db2 OVERFLOWING
... parentData: offset=Offset(0.0, 24.0) (can use size)
... constraints: BoxConstraints(w=411.4, h=377.1)
... size: Size(411.4, 377.1)
... direction: vertical
... mainAxisAlignment: spaceBetween
... mainAxisSize: max
... crossAxisAlignment: stretch
... verticalDirection: down
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
════════════════════════════════════════════════════════════════════════════════════════════════════
I installed the clima weather detection app on android
I enabled the location services in the mobile as well as the app.
But it’s not moving forward to the loading page
It’s stuck on that loading screen
Do I need to provide api nearer to my country ?? Or something else. Please help me on this
It is not syncing files with android
I know these tutorial files are old, but is it possible to run these files now?
Exception caught by widgets library =======================================================
The following assertion was thrown building Builder:
_LoadingScreenState.initState() returned a Future.
State.initState() must be a void method without an async
keyword.
Rather than awaiting on asynchronous work directly inside of initState, call a separate method to do this work without awaiting it.
The relevant error-causing widget was:
MaterialApp file:///E:/flutter_projects/Clima-Flutter/lib/main.dart:9:12
When the exception was thrown, this was the stack:
apk was build using flutter build apk command from CLI and app-release.apk file used for installation.
This error is because of open weather API
Replace
double temp = weatherData['main']['temp'];
temperature = temp.toInt();
with
if (weatherData['main']['temp'].runtimeType == double) {
double temp = weatherData['main']['temp'];
temperature = temp.toInt();
} else {
temperature = weatherData['main']['temp'];
}
and it should work.
Originally posted by @kiranojhanp in #20 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.