bizz84 / firebase_user_avatar_flutter Goto Github PK
View Code? Open in Web Editor NEWAdvanced Provider Architecture Demo: Image Picker + Firebase Storage Upload
Home Page: https://codewithandrea.com/
License: MIT License
Advanced Provider Architecture Demo: Image Picker + Firebase Storage Upload
Home Page: https://codewithandrea.com/
License: MIT License
FAILURE: Build failed with an exception.
No matching client found for package name 'com.example.firebase_user_avatar_flutter'
You need replace in android/app/build.gradle :
line 41 :
applicationId "com.example.firebase_user_avatar_flutter"
by
applicationId "com.codingwithflutter.firebase_user_avatar_flutter"
Hello
Love your videos and thank you for putting in so much effort.
I have 2 questions
I have used your approach for authentication stream.
That is okey.
In my project, I needed to use onGenerateRoute: property of MaterialApp widget which is child of AuthWidgetBuilder.
When the stream: _authService.onAuthStateChanged emit new state once login or logout event, while MaterialApp constructs new tree, MatrearialApp home: doesn't activated and doesn't route to AuthWidget.
If you refresh whole application, then no problem, but again if you logout or login the MaterialApp does not visit home: property.
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:family_infopool/core/models/user.dart';
import 'package:family_infopool/core/services/connectivity_service.dart';
import 'package:family_infopool/ui/widgets/auth_widget_builder.dart';
import 'package:family_infopool/core/states/share_app_state.dart';
import 'package:family_infopool/core/managers/dialog_manager.dart';
import 'package:family_infopool/core/services/navigation_service.dart';
import 'package:family_infopool/core/services/dialog_service.dart';
import 'package:family_infopool/ui/views/startup_view.dart';
import 'package:family_infopool/ui/widgets/header_footer.dart';
import 'package:family_infopool/ui/router.dart';
import 'package:family_infopool/locator.dart';
import 'core/services/live_user_profile_service.dart';
void main() {
setupLocator();
LiveUserProfile dummyLiveUserProfile = LiveUserProfile(user: User.initial());
runApp(MultiProvider(
providers: [
Provider<LiveUserProfile>.value(value: dummyLiveUserProfile),
ChangeNotifierProvider<ShareAppState>(
create: (context) => ShareAppState()),
StreamProvider<ConnectivityStatus>(
create: (context) => ConnectivityService().connectionStatusController.stream),
],
child:MyApp()
));
}
final RouteObserver routeObserver = RouteObserver();
final MyRouteObserver myRouteObserver = MyRouteObserver();
class MyApp extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
print('(MyApp): MyApp starts.');
return KeyShare(
child: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: AuthWidgetBuilder(
builder: (context, userSnapshot) {
print('(MyApp): MaterialApp starts.[${userSnapshot.connectionState}]');
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'iPikuka Family InfoPool',
theme: ThemeData(),
home: StartUpView(userSnapshot: userSnapshot), //which is smilar implematation of AuthWidget
navigatorObservers: <NavigatorObserver>[myRouteObserver],
onGenerateRoute: generateRoute,
navigatorKey: locator<NavigationService>().navigationKey,
builder: (context, child) {
print('(MyApp): Navigator for Dialog Service created.');
//There was a problem if visit this Navigator when ConnectionState.waiting, so this is a prevention solution.
if (userSnapshot.connectionState != ConnectionState.active)
return Container();
else
return Navigator(
observers: <NavigatorObserver>[routeObserver],
key: locator<DialogService>().dialogNavigationKey,
onGenerateRoute: (settings) => MaterialPageRoute(
maintainState: true,
builder: (context) => DialogManager(child: child)),
);
},
);
},
),
),
);
}
}
For managing authState
, why do you use a streamBuilder
? Is not not suitable to use a Consumer()
?
I just thought that that if you are using Provider, there is no need to have streamBuilder
as the parent widget. Am I missing something? Can the authState
widget be made without streamBuilder
?
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.