Skip to content
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

App is not loading #28

Open
sharmahal opened this issue Aug 15, 2020 · 7 comments
Open

App is not loading #28

sharmahal opened this issue Aug 15, 2020 · 7 comments

Comments

@sharmahal
Copy link

after adding video calling functionality to the app. when I run the app, it just shows the circular progress indicator.

the error I am getting is -
E/flutter (25915): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method '[]' was called on null.
E/flutter (25915): Receiver: null
E/flutter (25915): Tried calling:

@Ronak99
Copy link
Owner

Ronak99 commented Aug 15, 2020

Well, since this is a run time issue, I'd probably need to see the code. Please host a gist for the corresponding code and share the link.

@kazimad kazimad mentioned this issue Aug 16, 2020
@sharmahal
Copy link
Author

@sharmahal
Copy link
Author

Well, since this is a run time issue, I'd probably need to see the code. Please host a gist for the corresponding code and share the link.

https://gist.github.com/sharmahal/13cbebf847de8ee44aca030ccdc5cc41

@Ronak99
Copy link
Owner

Ronak99 commented Aug 16, 2020

You did too much hard work in creating all those gists, if you did everything manually.
You could've just shared the code repository with me.
I only wanted the code from the file where you are stuck, because I already have the code for which you went through all that trouble of creating gists.

Anyways, please let me know which branch are you on, and compare the code with that branch. I'll try my best to locate the problem.

@sharmahal
Copy link
Author

You did too much hard work in creating all those gists, if you did everything manually.
You could've just shared the code repository with me.
I only wanted the code from the file where you are stuck, because I already have the code for which you went through all that trouble of creating gists.

Anyways, please let me know which branch are you on, and compare the code with that branch. I'll try my best to locate the problem.

I am on part 12, I tried comparing the code with this branch.

@AndreLiu1225
Copy link

Hello. Many thanks for the video tutorials. It is really a stepping stone for me in flutter. However, have you solved this issue yet by any chance?

@Lorngdy68
Copy link

Lorngdy68 commented May 19, 2021

I also face this problem too. Could you check this code?

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
import 'package:skypeclone/resources/firebaserepository.dart';
import 'package:skypeclone/screens/homescreen.dart';
import 'package:skypeclone/utils/universalvariables.dart';

class LoginScreen extends StatefulWidget {
const LoginScreen({Key key}) : super(key: key);

@OverRide
_LoginScreenState createState() => _LoginScreenState();
}

class _LoginScreenState extends State {

FirebaseRepository _repository = FirebaseRepository();

bool isLoginPressed = false;

@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: UniversalVariables.blackColor,
body: Stack(
children: [
Center(
child: loginButton(),
),
isLoginPressed ? Center(child: CircularProgressIndicator(),
) : Container(),
],
),
);
}

Widget loginButton() {
return Shimmer.fromColors(
baseColor: Colors.white,
highlightColor: UniversalVariables.senderColor,
child: Center(
child: ElevatedButton(
onPressed: () => performLogin(),
child: Text("LOGIN"),
// style: ButtonStyle(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
),
),
);
}

void performLogin() {

print("Bring to perform login");
setState(() {
  isLoginPressed = true;
});

_repository.signIn().then((User user) => {
  if(user != null) {
    authenticateUser(user),
  }
  else {
    print("There was an error"),
}
});

}

void authenticateUser(User user) {
_repository.authenticateUser(user).then((isNewUser) {
setState(() {
isLoginPressed = false;
});

  if(isNewUser) {
    _repository.addDataToDb(user).then((value){
      Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) =>
         HomeScreen()
      ));
    });
  }
  else {
    Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) =>
        HomeScreen()
    ));
  }
});

}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants