Skip to content

Commit

Permalink
[firebase_core] Put the 'dart:io' import behind a configurable import (
Browse files Browse the repository at this point in the history
…firebase#1609)

* [firebase_core] Put the 'dart:io' import behind a configurable import

This should make the plugin register as supporting Web on pub.dev

* dartfmt

* Remove unnecessary library directive
  • Loading branch information
Harry Terkelsen authored Dec 11, 2019
1 parent 68eb9fa commit c8debc9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
5 changes: 5 additions & 0 deletions packages/firebase_core/firebase_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.4.3+1

* Move `Platform.isIOS` check behind a configurable import so that pub.dev registers
this as a Web plugin.

## 0.4.3

* Enable the `web` implementation by default.
Expand Down
11 changes: 1 addition & 10 deletions packages/firebase_core/firebase_core/lib/firebase_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

library firebase_core;

import 'dart:async';
import 'dart:io' show Platform;

import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:meta/meta.dart';

export 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'
show FirebaseOptions;

part 'src/firebase_app.dart';
export 'src/firebase_app.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// 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.

/// The default app name.
const String firebaseDefaultAppName = '[DEFAULT]';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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:io';

/// The default app name.
final String firebaseDefaultAppName =
Platform.isIOS ? '__FIRAPP_DEFAULT' : '[DEFAULT]';
10 changes: 7 additions & 3 deletions packages/firebase_core/firebase_core/lib/src/firebase_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

part of firebase_core;
import 'dart:async';

import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:meta/meta.dart';

import 'default_app_name.dart' if (dart.library.io) 'default_app_name_io.dart';

class FirebaseApp {
// TODO(jackson): We could assert here that an app with this name was configured previously.
Expand All @@ -11,8 +16,7 @@ class FirebaseApp {
/// The name of this app.
final String name;

static final String defaultAppName =
(!kIsWeb && Platform.isIOS) ? '__FIRAPP_DEFAULT' : '[DEFAULT]';
static final String defaultAppName = firebaseDefaultAppName;

/// A copy of the options for this app. These are non-modifiable.
///
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_core/firebase_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: firebase_core
description: Flutter plugin for Firebase Core, enabling connecting to multiple
Firebase apps.
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_core/firebase_core
version: 0.4.3
version: 0.4.3+1

flutter:
plugin:
Expand Down

0 comments on commit c8debc9

Please sign in to comment.