firebase_core 0.4.0+9

  • Readme
  • Changelog
  • Example
  • Installing
  • --

Firebase Core for Flutter #

pub package

A Flutter plugin to use the Firebase Core API, which enables connecting to multiple Firebase apps.

For Flutter plugins for other Firebase products, see

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

Usage #

To use this plugin, add firebase_core as a dependency in your pubspec.yaml file.

Getting Started #

See the example directory for a complete sample app using Firebase Core.

0.4.0+9 #

  • Update documentation to reflect new repository location.
  • Update unit tests to call TestWidgetsFlutterBinding.ensureInitialized.

0.4.0+8 #

  • Update google-services Android gradle plugin to 4.3.0 in documentation and examples.

0.4.0+7 #

  • Fix Android compilation warning.

0.4.0+6 #

  • Automatically use version from pubspec.yaml when reporting usage to Firebase.

0.4.0+5 #

  • Rollback of automatic plugin version retrieval.

0.4.0+4 #

  • Automate the retrieval of the plugin's version when reporting usage to Firebase.

0.4.0+3 #

  • Add missing template type parameter to invokeMethod calls.
  • Bump minimum Flutter version to 1.5.0.
  • Replace invokeMethod with invokeMapMethod wherever necessary.

0.4.0+2 #

  • Update user agent name. Set to flutter-fire-core for consistency with other libraries.

0.4.0+1 #

  • Send user agent to Firebase.

0.4.0 #

  • Update Android dependencies to latest.

0.3.4 #

  • Updates Android firebase-core dependency to a version that is compatible with other Flutterfire plugins.

0.3.3 #

  • Remove Gradle BoM to avoid Gradle version issues.

0.3.2 #

  • Move Android dependency to Gradle BoM to help maintain compatability with other FlutterFire plugins.

0.3.1+1 #

  • Add nil check on static functions to prevent crashes or unwanted behaviors.

0.3.1 #

  • Remove an assertion that can interfere with hot-restart.

0.3.0+2 #

  • Remove categories.

0.3.0+1 #

  • Log a more detailed warning at build time about the previous AndroidX migration.

0.3.0 #

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

0.2.5+1 #

  • Bump Android dependencies to latest.

0.2.5 #

  • Bump Android and Firebase dependency versions.

0.2.4 #

  • Updated Gradle tooling to match Android Studio 3.1.2.

0.2.3 #

  • Updated Google Play Services dependencies to version 15.0.0.

0.2.2 #

  • Simplified podspec for Cocoapods 1.5.0, avoiding link issues in app archives.

0.2.1 #

  • Fix setting project ID on Android.

0.2.0 #

  • Breaking change. Options API is now async to interoperate with native code that configures Firebase apps.
  • Provide a getter for the default app
  • Fix setting of GCM sender ID on iOS

0.1.2 #

  • Fix projectID on iOS

0.1.1 #

  • Fix behavior of constructor for named Firebase apps.

0.1.0 #

  • Breaking change. Set SDK constraints to match the Flutter beta release.

0.0.7 #

  • Fixed Dart 2 type errors.

0.0.6 #

  • Enabled use in Swift projects.

0.0.5 #

  • Moved to the io.flutter.plugins org.

0.0.4 #

  • Fixed warnings from the Dart 2.0 analyzer.
  • Simplified and upgraded Android project template to Android SDK 27.
  • Updated package description.

0.0.3 #

  • Breaking change. Upgraded to Gradle 4.1 and Android Studio Gradle plugin 3.0.1. Older Flutter projects need to upgrade their Gradle setup as well in order to use this version of the plugin. Instructions can be found here.

0.0.2 #

  • Fixes for database URL on Android
  • Make GCM sender id optional on Android
  • Relax GMS dependency to 11.+

0.0.1 #

  • Initial Release


// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final String name = 'foo';
  final FirebaseOptions options = const FirebaseOptions(
    googleAppID: '1:297855924061:ios:c6de2b69b03a5be8',
    gcmSenderID: '297855924061',
    apiKey: 'AIzaSyBq6mcufFXfyqr79uELCiqM_O_1-G72PVU',

  Future<void> _configure() async {
    final FirebaseApp app = await FirebaseApp.configure(
      name: name,
      options: options,
    assert(app != null);
    print('Configured $app');

  Future<void> _allApps() async {
    final List<FirebaseApp> apps = await FirebaseApp.allApps();
    print('Currently configured apps: $apps');

  Future<void> _options() async {
    final FirebaseApp app = await FirebaseApp.appNamed(name);
    final FirebaseOptions options = await app?.options;
    print('Current options for app $name: $options');

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Firebase Core example app'),
        body: Padding(
          padding: const EdgeInsets.all(20.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: <Widget>[
                  onPressed: _configure, child: const Text('initialize')),
              RaisedButton(onPressed: _allApps, child: const Text('allApps')),
              RaisedButton(onPressed: _options, child: const Text('options')),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  firebase_core: ^0.4.0+9

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:firebase_core/firebase_core.dart';
Awaiting analysis to complete.