Posts

Showing posts from September, 2019

Yes we can: Writing Firestore Admin functions in Dart, and using the Firestore Emulator

Image
Thanks to the awesome Firestore Admin Interop library,  you can write Firestore admin functions in Dart (and yes Googlers, if you are reading this, we *really* need a native Dart Firebase SDK). If you are curious how the interop library works: The dart2js compiler translates your Dart code to Javascript. The interop library wraps the native nodejs library for Firestore,  allowing you to call it from your Dart program. See here for information on the Admin SDK . As a nodejs and Firestore newbie, there were a couple of missing pieces for me on how to use this library: How do I wire this into my Firestore project? How do I use the local Firestore emulator? I won't cover this in depth (please see the example ), but here are few tips: The library is wired to your Firestore project via the service-account.json file that you download from the Firebase console (Project Settings > Service Accounts). Download and save this file (and DO NOT check it in to git !!) You do