Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ command:
preCommit: |
dart run scripts/generate_firebaseai_version.dart && \
dart run scripts/generate_dataconnect_version.dart && \
dart run scripts/generate_versions_web.dart && \
dart run scripts/generate_versions_spm.dart && \
git add packages/firebase_data_connect/firebase_data_connect/lib/src/dataconnect_version.dart
git add packages/firebase_data_connect/firebase_data_connect/lib/src/dataconnect_version.dart && git add packages/*/*_web/lib/src/*_version.dart
post: |
dart run scripts/generate_tag_spm_firebase_core.dart

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ import 'src/query_web.dart';
import 'src/transaction_web.dart';
import 'src/write_batch_web.dart';

import 'src/cloud_firestore_version.dart';

/// Web implementation for [FirebaseFirestorePlatform]
/// delegates calls to firestore web plugin
class FirebaseFirestoreWeb extends FirebaseFirestorePlatform {
static const String _libraryName = 'flutter-fire-fst';

/// instance of Firestore from the web plugin
firestore_interop.Firestore? _webFirestore;

Expand All @@ -41,6 +45,8 @@ class FirebaseFirestoreWeb extends FirebaseFirestorePlatform {

/// Called by PluginRegistry to register this plugin for Flutter Web
static void registerWith(Registrar registrar) {
FirebaseCoreWeb.registerLibraryVersion(_libraryName, packageVersion);

FirebaseCoreWeb.registerService('firestore');
FirebaseFirestorePlatform.instance = FirebaseFirestoreWeb();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// generated version number for the package, do not manually edit
const packageVersion = '6.0.2';
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'https_callable_web.dart';
import 'interop/functions.dart' as functions_interop;

import 'src/cloud_functions_version.dart';

/// Web implementation of [FirebaseFunctionsPlatform].
class FirebaseFunctionsWeb extends FirebaseFunctionsPlatform {
static const String _libraryName = 'flutter-fire-fn';

/// The entry point for the [FirebaseFunctionsWeb] class.
FirebaseFunctionsWeb({FirebaseApp? app, required String region})
: super(app, region);
Expand All @@ -36,6 +40,8 @@ class FirebaseFunctionsWeb extends FirebaseFunctionsPlatform {

/// Create the default instance of the [FirebaseFunctionsPlatform] as a [FirebaseFunctionsWeb]
static void registerWith(Registrar registrar) {
FirebaseCoreWeb.registerLibraryVersion(_libraryName, packageVersion);

FirebaseCoreWeb.registerService('functions');
FirebaseFunctionsPlatform.instance = FirebaseFunctionsWeb.instance;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// generated version number for the package, do not manually edit
const packageVersion = '6.0.2';
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import 'package:firebase_core_web/firebase_core_web_interop.dart'
as core_interop;
import 'package:flutter_web_plugins/flutter_web_plugins.dart';

import 'src/firebase_analytics_version.dart';

import 'interop/analytics.dart' as analytics_interop;

/// Web implementation of [FirebaseAnalyticsPlatform]
class FirebaseAnalyticsWeb extends FirebaseAnalyticsPlatform {
static const String _libraryName = 'flutter-fire-analytics';

/// instance of Analytics from the web plugin
analytics_interop.Analytics? _webAnalytics;

Expand All @@ -36,6 +40,8 @@ class FirebaseAnalyticsWeb extends FirebaseAnalyticsPlatform {

/// Called by PluginRegistry to register this plugin for Flutter Web
static void registerWith(Registrar registrar) {
FirebaseCoreWeb.registerLibraryVersion(_libraryName, packageVersion);

FirebaseCoreWeb.registerService('analytics');
FirebaseAnalyticsPlatform.instance = FirebaseAnalyticsWeb();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// generated version number for the package, do not manually edit
const packageVersion = '12.0.2';
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import 'package:web/web.dart' as web;
import 'src/internals.dart';
import 'src/interop/app_check.dart' as app_check_interop;

import 'src/firebase_app_check_version.dart';

class FirebaseAppCheckWeb extends FirebaseAppCheckPlatform {
static const String _libraryName = 'flutter-fire-app-check';
static const recaptchaTypeV3 = 'recaptcha-v3';
static const recaptchaTypeEnterprise = 'enterprise';
static Map<String, StreamController<String?>> _tokenChangesListeners = {};
Expand All @@ -32,6 +35,8 @@ class FirebaseAppCheckWeb extends FirebaseAppCheckPlatform {

/// Called by PluginRegistry to register this plugin for Flutter Web
static void registerWith(Registrar registrar) {
FirebaseCoreWeb.registerLibraryVersion(_libraryName, packageVersion);

FirebaseCoreWeb.registerService(
'app-check',
productNameOverride: 'app_check',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// generated version number for the package, do not manually edit
const packageVersion = '0.4.1';
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'src/guard.dart';
import 'src/interop/installations.dart' as installations_interop;

import 'src/firebase_app_installations_version.dart';

class FirebaseAppInstallationsWeb extends FirebaseAppInstallationsPlatform {
static const String _libraryName = 'flutter-fire-installations';

/// The entry point for the [FirebaseAppInstallationsWeb] class.
FirebaseAppInstallationsWeb({FirebaseApp? app}) : super(app);

Expand All @@ -33,6 +37,8 @@ class FirebaseAppInstallationsWeb extends FirebaseAppInstallationsPlatform {

/// Create the default instance of the [FirebaseAppInstallationsPlatform] as a [FirebaseAppInstallationsWeb]
static void registerWith(Registrar registrar) {
FirebaseCoreWeb.registerLibraryVersion(_libraryName, packageVersion);

FirebaseCoreWeb.registerService('installations');
FirebaseAppInstallationsPlatform.instance =
FirebaseAppInstallationsWeb.instance;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// generated version number for the package, do not manually edit
const packageVersion = '0.4.0+2';
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:web/web.dart' as web;

import 'src/firebase_auth_version.dart';

import 'src/firebase_auth_web_confirmation_result.dart';
import 'src/firebase_auth_web_recaptcha_verifier_factory.dart';
import 'src/firebase_auth_web_user.dart';
Expand All @@ -28,6 +30,8 @@ enum StateListener { authStateChange, userStateChange, idTokenChange }

/// The web delegate implementation for [FirebaseAuth].
class FirebaseAuthWeb extends FirebaseAuthPlatform {
static const String _libraryName = 'flutter-fire-auth';

/// Stub initializer to allow the [registerWith] to create an instance without
/// registering the web delegates or listeners.
FirebaseAuthWeb._()
Expand All @@ -46,6 +50,8 @@ class FirebaseAuthWeb extends FirebaseAuthPlatform {

/// Called by PluginRegistry to register this plugin for Flutter Web
static void registerWith(Registrar registrar) {
FirebaseCoreWeb.registerLibraryVersion(_libraryName, packageVersion);

FirebaseCoreWeb.registerService(
'auth',
ensurePluginInitialized: (firebaseApp) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// generated version number for the package, do not manually edit
const packageVersion = '6.1.0';
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import 'dart:js_interop';
import 'dart:js_interop_unsafe';

import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:firebase_core_web/src/firebase_core_version.dart';
import 'package:firebase_core_web/src/interop/package_web_tweaks.dart';
import 'package:firebase_core_web/src/interop/utils/es6_interop.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:meta/meta.dart';
import 'package:web/web.dart' as web;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// generated version number for the package, do not manually edit
const packageVersion = '4.1.1';
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class FirebaseCoreWeb extends FirebasePlatform {
'core': FirebaseWebService._('app', override: 'core'),
};

static Map<String, String> _libraryVersions = {};

/// Internally registers a Firebase Service to be initialized.
static void registerService(
String service, {
Expand All @@ -55,11 +57,34 @@ class FirebaseCoreWeb extends FirebasePlatform {
);
}

static const String _libraryName = 'flutter-fire-core';

/// Registers that [FirebaseCoreWeb] is the platform implementation.
static void registerWith(Registrar registrar) {
FirebasePlatform.instance = FirebaseCoreWeb();
}

/// Registers a library's name and version for platform logging purposes if needed.
static void _registerVersionIfNeeded(
String libraryName,
String packageVersion,
) {
final sessionKey = 'flutterfire-$libraryName-$packageVersion';
final sessionItem = web.window.sessionStorage.getItem(sessionKey);
if (sessionItem == null) {
web.window.sessionStorage.setItem(sessionKey, packageVersion);
firebase.registerVersion(libraryName, packageVersion);
}
}

static void registerLibraryVersion(String libraryName, String version) {
_libraryVersions[libraryName] = version;
}

static void _registerAllLibraryVersions() {
_libraryVersions.forEach(_registerVersionIfNeeded);
}

/// Returns the Firebase JS SDK Version to use.
///
/// You can override the supported version by attaching a version string to
Expand Down Expand Up @@ -195,6 +220,8 @@ class FirebaseCoreWeb extends FirebasePlatform {
);
}),
);
registerLibraryVersion(_libraryName, packageVersion);
_registerAllLibraryVersions();
}

/// Returns all created [FirebaseAppPlatform] instances.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ App app([String? name]) {
);
}

void registerVersion(String libraryKeyOrName, String version,
[String? variant]) {
firebase_interop.registerVersion(
libraryKeyOrName.toJS,
version.toJS,
variant?.toJS ?? 'flutter-firebase'.toJS,
);
}

class FirebaseError {
final String code;
final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ external AppJsImpl getApp([JSString? name]);
@JS()
external JSPromise deleteApp(AppJsImpl app);

@JS()
external void registerVersion(
JSString libraryKeyOrName,
JSString version, [
JSString? variant,
]);

/// FirebaseError is a subclass of the standard Error object.
/// In addition to a message string, it contains a string-valued code.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';

import 'src/interop/database.dart' as database_interop;

import 'src/firebase_database_version.dart';

part './src/data_snapshot_web.dart';
part './src/database_event_web.dart';
part './src/database_reference_web.dart';
Expand All @@ -27,6 +29,8 @@ part './src/utils/snapshot_utils.dart';
/// Web implementation for [DatabasePlatform]
/// delegates calls to firebase web plugin
class FirebaseDatabaseWeb extends DatabasePlatform {
static const String _libraryName = 'flutter-fire-rtdb';

/// Instance of Database from web plugin
database_interop.Database? _firebaseDatabase;

Expand All @@ -41,6 +45,8 @@ class FirebaseDatabaseWeb extends DatabasePlatform {

/// Called by PluginRegistry to register this plugin for Flutter Web
static void registerWith(Registrar registrar) {
FirebaseCoreWeb.registerLibraryVersion(_libraryName, packageVersion);

FirebaseCoreWeb.registerService('database');
DatabasePlatform.instance = FirebaseDatabaseWeb();
}
Expand Down
Loading
Loading