Git Product home page Git Product logo

firebase_user_avatar_flutter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

firebase_user_avatar_flutter's Issues

Wrong applicationID

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugGoogleServices'.

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"

Null safety update

Hello
Love your videos and thank you for putting in so much effort.
I have 2 questions

  1. Will you update the code for null safety?
  2. Don't you have to initialize all providers under MultiProvider?
    When trying to use your code, it wants to me initialize FireStoreService provider as well, which i try to do like this
    Provider
    (
    create: (context) => FirestoreService(uid: UserData().uid),
    ),
    However, since UserData().uid is null at that point, i don't think this will work, even with assert(uid.isNotEmpty)

AuthWidgetBuilder Conflicts with MaterialApp onGenerateRoute: generateRoute property

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)),
            );
        },
      );
      
      },
    ),
  ),
);

}
}

streamBuilder vs Consumer / changeNotifier

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.