Closed ducnv-ifvietnam closed 4 years ago
Same issue here.
Hey, I have no idea. I haven't looked at that code since I wrote it. The point of my videos is NOT to teach an exact solution. I'm showing how to solve a problem which you'll have to build on afterwards. If you look at my videos you'll it tackles one topic at a time, in this video you mentioned above I think I said I won't do that with the User. I won't expose it over a stream since that's not a good implementation. I did it like that so that you can see that it's possible to do that with other things if required. If you're looking for the way I really implement my user exposure to ViewModels you should watch my firebase startup logic and user profiles video.
That's how I do things in my production code bases.
Please check StreamProvier in your code. In code bellow, i have a problem at
initialData: User.initial(),
you will can't get data from server with getPost method because getPost using a default object of constructor. I had to removeinitialData: User.initial(),
for the application to work properly but have a warning null. Plz explain it for me.Sorry about my englishclass MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return StreamProvider<User>( initialData: User.initial(), create: (BuildContext context) => locator<AuthenticationService>().userController.stream, child: MaterialApp( title: 'Flutter Demo', theme: ThemeData(), initialRoute: "login", onGenerateRoute: Router.generateRoute, ), ); } }