Video demo is on youtube here
- Set up a new firebase project, and link it with an android app (work with the
/android
folder in flutter). Follow along the steps. - In the firebase console under "Authentication", set up email and anonymous login methods.
- Don't forget to add your
google-services.json
in theandroid/app/
folder!
- import :
import 'package:firebase_tutorial/services/localNotifications.dart';
- use :
showNotification(id, "Title", "Body");
(id
is an integer)
- keep models(classes) seperate from the UI files. Also bunch related UI files together.
- We use
Streams
in dart to lisen for changes (eg: listen for change in authentication status in the wrapper).- Each peice of information in a
Stream
in being continually sent. Basically, dont send shit all at once, but send it as and when you recieve it.
- Each peice of information in a
- We use the
Provider
package for listening to changes lower in the widget tree from somewhere higher in the widget tree. It is the recommended way for state management in flutter. It is used in the root widget (main.dart
here) - Can pass functions to children as parameters, which toggle the parent's state (here, to switch views). For example, check out how register and sign in are switched. There is no
Material.push()
or whatever that is, to manually push/pop a page from the stack. It's all handled by a parent class controlling both the states. - We are also use another stream from firebase, which notifies us of and document/document changes that happen in our database. We user
Provider
again, in thehome.dart
(the homepage) - getters are usually used for stream definition, so other classes just call this getter.
- make sure streams are getting updated with the data they are listening to changes for
- Can actually have more than 1 emulator running, with each acting as a seperate user.
flutter clean
when you have no clue on why your app won't build.- Make sure returned value from firebase cloud function,eg, in
index.ts
, is JSON-serialisable. - Devices are identified with a
fcm
(got ingetDeviceToken
inpushNotification.dart
). You can't use the the Firebase Auth uid as the fcm. Gotta store and use it seperately. - Sometimes users will have to be re-registered for fcm token to be valid. (Do this if the notifications are not working)
- can use
if
within columns etc to show/hide widgets, like so.
- do something with the toggle dengue button in
alertMe.dart
- user currentlocation service for getting current location of the user everywhere.
- remove api key from
android/app/src/main/AndroidManifest.xml
and everywhere else after project is over.
- Hot reload on multiple devices
- Pass provider state to another route
- Circular button
- Adding assets
- Get directions from A to B in google maps
- Making a page scrollable
- Push notifications with flutter. Can send notification on firebase console > Cloud messaging
- Firebase puch notification to custom user. Seems to use Typescript to define a custom cloud function. Unnessessarily complicated.
- Firebase custom fn tutorial
- Firebase cloud fns on pub.dev
- bugfix: gradle has no permission
- Set up Firebase CLI
- Set up firebase functions in project root using
firebase init functions
, and after adding function runfirebase deploy
- Firebase versioning error fix
- Get documents from firestore collection : typescript
- Rename app
- Icons made by Freepik from www.flaticon.com
- Change app icon
- Pass scaffold context with key
- Keyboard causing bottom overflow fix: SingleChildScrollView
- Align images in markdown
- Show/hide widgets based on a bomb-ass if condition
- App-wide local notifications