FilledStacks / flutter-tutorials

The repo contains the source code for all the tutorials on the FilledStacks Youtube channel.
MIT License
4.75k stars 1.76k forks source link

27-location-service main.dart The return type 'Stream<userLocation> is not a StreamController<userLocation> as defined by anonmyous closure #27

Closed billyurs closed 5 years ago

billyurs commented 5 years ago

I am getting error at this line

@override Widget build(BuildContext context) { return StreamProvider( builder: (context) => LocationService().locationStream, child: MaterialApp(title: 'Flutter Demo', home: HomeView())); }

FilledStacks commented 5 years ago

You should read what the error is and then fix it 😄

You need a controller. Not a stream. So provide the controller. Not the stream

Tabarek commented 5 years ago

use StreamProvider.controller instead of StreamProvider

rizerzero commented 4 years ago

StreamProvider( create: (context) => ConnectivityService().connectionStatusController.stream, )

c-shashank commented 4 years ago

I get the error error: The argument type 'Widget Function(BuildContext)' can't be assigned to the parameter type 'Widget Function(BuildContext, Widget)'. (argument_type_not_assignable at [appint] lib/main.dart:32) when I try to put this in main.dart

FilledStacks commented 4 years ago

@c-shashank seems like you're trying to supply a Widget where it expects a function that returns a widget. Use

(context) => Widget()

instead of

Widget()