Skip to content

Instantly share code, notes, and snippets.

View itsbohara's full-sized avatar
🇳🇵

Mahesh itsbohara

🇳🇵
View GitHub Profile
method 1 .
this.afs.doc('collectionName/documentId').ref.get().then((documentSnapshot) => {
console.log(documentSnapshot.exists);
});
method 2
this.afs.firestore.doc('collectionName/documentId').get().then((documentSnapshot) => {
console.log(documentSnapshot.exists);
});
// / /... .. . //
final FirebaseAuth _auth = FirebaseAuth.instance;
Future<String> signInWithGoogle() async {
try{
final GoogleSignIn _googleSignIn = new GoogleSignIn();
GoogleSignInAccount googleUser = await _googleSignIn.signIn();
GoogleSignInAuthentication googleAuth = await googleUser.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
@itsbohara
itsbohara / MaterialAppInitalRoute.dart
Created August 16, 2019 03:55 — forked from dereklakin/MaterialAppInitalRoute.dart
MaterialApp using initialRoute and onGenerateRoute
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: '/login',
onGenerateRoute: generateRoute,
title: 'Test App',
);
}
/**
* Author: MB
**/
import 'package:flutter/material.dart';
class MyClass extends StatefulWidget {
@override
_MyClassState createState() => _MyClassState();
}