Current Time 0:00
/
Duration Time 0:00
Progress: NaN%
Playback Rate
1.00x
Closed Caption

Setup Firebase Cloud Firestore

Code

https://github.com/tinycasts/notee/tree/feature/episode_06

Snippets

To configure iOS

Drop the config file at

ios/Runner/GoogleService-Info.plist

To configure Android

Drop the config file at

android/app/google-services.json

Main File

  1. Import Cloud Firestore
import 'package:cloud_firestore/cloud_firestore.dart';
  1. Wrap Text with GestureDetector and define onTap
class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: BoxDecoration(
          gradient: LayoutTheme.of(context).background
        ),
        child: Center(
          child: GestureDetector(
            child: Text('Home', style: LayoutTheme.of(context).text.title),
            onTap: () async {
              DocumentReference doc = Firestore.instance.collection('notes').document();
              await doc.setData({ 'title': 'New Note', 'description': 'Cool note' });
              print('Done writing doc ${doc.documentID}');
            },
          )
        ),
      )
    );
  }
}

Discuss

Loading comments...