Skip to content

Instantly share code, notes, and snippets.

View prasadshirvandkar's full-sized avatar
💻
Developing

Prasad Shirvandkar prasadshirvandkar

💻
Developing
View GitHub Profile
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutterapp/constants.dart';
import 'package:flutterapp/core/models/user_model.dart';
import 'package:flutterapp/persistance/user_box.dart';
import 'package:google_sign_in/google_sign_in.dart';
class FirebaseGoogleAuthentication {
static final FirebaseAuth firebaseAuth = FirebaseAuth.instance;
static final GoogleSignIn googleSignIn = GoogleSignIn();
import 'package:firebase_auth/firebase_auth.dart';
class User {
String id;
String name;
String imageUrl;
String email;
String address;
//Call this method to Invoke GoogleSignIn Functionality
FirebaseGoogleAuthentication.signInWithGoogle()
.whenComplete(() {
Navigator.pop(context);
Navigator.push(context,MaterialPageRoute(builder: (_) => MainPage()));
})
{
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "launch",
"type": "dart",
"args": [
"--web-hostname",
"localhost",
import android.util.Log
import com.google.firebase.firestore.CollectionReference
import com.google.firebase.firestore.Query
import com.google.firebase.firestore.ktx.firestore
import com.google.firebase.ktx.Firebase
import com.midsizemango.scribblergame.Constants.Companion.FIRESTORE
class FirestoreAPI(collectionName: String) {
private val db = Firebase.firestore
private var collectionRef: CollectionReference
//Getting Downloaded URI directly
uploadFile(MediaInfo mediaInfo, String ref, String fileName) {
try {
String mimeType = mime(basename(mediaInfo.fileName));
var metaData = UploadMetadata(contentType: mimeType);
StorageReference storageReference = storage().ref(ref).child(fileName);
UploadTask uploadTask = storageReference.put(mediaInfo.data, metaData);
var imageUri;
uploadTask.future.then((snapshot) => {
imagePicker() {
return ImagePickerWeb.getImageInfo.then((MediaInfo mediaInfo) {
uploadFile(mediaInfo, 'images', mediaInfo.fileName);
});
}