-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: This expression has type 'void' and can't be used. #1
Comments
Im having issues with same problem... |
Hi AdalWay I've found a solution instead of using future void in class network helper just use future. As the function is returning a value so we cannot assign future. I've no idea how did it work in the video of the tutor. |
In NetworkHelper as you are returning something it cant be void |
This solution works with me. |
Yah this also works for me thanks @RIP321 |
Same problem... I ran into a different problem when I remove the from my Future function in the networking: |
Share your code |
i have also same problem "error: This expression has a type of 'void' so its value can't be used. (use_of_void_result at [clima] lib\screens\loading_screen.dart:38)" |
Please share your code |
me too |
That helped me |
i have also same problem. |
The error resolved by running the application on real / physical devices because emulator or simulator has the problem of getting real time location as per my knowledge and understanding after working for three days on this issue. |
Thx so much, to anyone who didn't understand it's the getData function which Angela made us Future, but since it the JsonDecode(data), which we have set weatherData to which we are trying to make it the location screen input, is being returned, so it's only Future, not Future |
I've found a solution instead of using future void in class network helper just use future. import 'package:http/http.dart' as http; class Networking { Future getData() async { |
Use :
Then:
Actually you are using var datatype assigning a void i.e. |
import 'package:audioplayers/audioplayers.dart'; void main() { class MyApp extends StatelessWidget { // This widget is the root of your application. class MusicApp extends StatefulWidget { @OverRide class _MusicAppState extends State { List musicList = [ String currentTitle = ""; AudioPlayer audioPlayer = new AudioPlayer(); Duration duration = new Duration(); void playMusic(String url) async {
} @OverRide
} lib/main.dart:106:43: Error: The argument type 'String' can't be assigned to the parameter type 'Source'.
|
lib/screens/loading_screen.dart:37:26: Error: This expression has type 'void' and can't be used.
locationWeather: weatherData,
In the video tutorial there is no error popping up, but when in my case the error this expression has a void and can't be used is there
Some help, please!
The text was updated successfully, but these errors were encountered: