firebase_core_vm 0.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

Firebase Core #

Dart implementation of the Firebase Core API, which enables connecting to multiple Firebase apps.

Note: This library is still under development, and some APIs might not be available yet or work correctly. Please feel free to open an issue here or even a pull requests if you feel brave.

Usage #

NOTES

  • can be used in CLIs, servers and Flutter.
  • does not work on Web
  • To use this package with the official firebase_core plugin on Flutter, see firebase_core_platform on how to use it.

0.0.4 #

  • Expose isWeb, isMobile and isDesktop based on conditional imports
  • Throw unimplemented error when trying to create a FirebaseApp in a js/html context

0.0.3 #

  • Rename library from firebase_common to firebase_core

0.0.2 #

  • Add flutter example
  • Update README

0.0.1 #

  • Initial release

example/lib/main.dart

// 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:firebase_core_vm/firebase_core_vm.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'platform_dependencies.dart';

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

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

  Future<void> _configure() async {
    final SharedPreferences preferences = await SharedPreferences.getInstance();
    final PlatformDependencies platform = PlatformDependencies(preferences);

    final FirebaseApp app =
        FirebaseApp.withOptions(options, name: name, dependencies: platform);
    assert(app != null);
    print('Configured $app');
  }

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

  Future<void> _options() async {
    try {
      final FirebaseApp app = FirebaseApp.getInstance(name);
      final FirebaseOptions options = app.options;
      print('Current options for app $name: $options');
    } catch (e) {
      print('The app has not been yet initialized.');
    }
  }

  @override
  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>[
              RaisedButton(
                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:


dependencies:
  firebase_core_vm: ^0.0.4

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_vm/firebase_core_vm.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on May 26, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (rxdart).

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
_firebase_internal_vm ^0.0.2 0.0.2
meta ^1.0.0 1.1.8
rxdart ^0.23.1 0.23.1 0.24.1
Transitive dependencies
collection 1.14.12
Dev dependencies
test ^1.0.0