Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[core] Decouple platform_interface from Flutter for pure-Dart web

未关闭
#18,645 3 条评论 2 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@Lyokone 已经在做这个了。

开始于 2026年9月17日。

  • #18788 来自 @cedvdb —— 未关闭

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
dart
领域
api, build-system

调研方向

首先阅读 firebase_core_platform_interface/pubspec.yaml 和 MethodChannelFirebase 的实现,然后比较 issue 中描述的相关 *_platform_interface 和 web 包。与 maintainers 一起审查 Option A 和 Option B,并确认 FirebaseException/PlatformException 契约。完成的标准是选定一个方向并解决验收标准。

由索引模型根据 Issue 内容生成。

描述

Needs Attention platform: all platform: web plugin: core type: enhancement
Context & Problem

Recent cleanups (#18604, #18624) removed package:flutter/foundation.dart, package:flutter/material.dart, and package:flutter_web_plugins imports from *_platform_interface data models and firebase_core_web. Because FlutterFire web implementations (firebase_core_web, firebase_auth_web, cloud_firestore_web) are built on dart:js_interop and package:web, they can compile to JS and Wasm GC without pulling in dart:ui or the Flutter engine.

However, non-Flutter Dart web frameworks (e.g. Jaspr) and pure-Dart environments cannot resolve these packages using standalone dart pub get because firebase_core_platform_interface (and sibling *_platform_interface packages) still declare flutter: sdk: flutter in pubspec.yaml.

The sole remaining reason *_platform_interface depends on flutter: sdk: flutter is that it bundles the default MethodChannel* implementation (package:flutter/services.dart). Meanwhile, package:plugin_platform_interface itself is already 100% pure Dart.

Proposed Options

We would like feedback from the maintainers on two architectural options to remove the flutter: sdk: flutter dependency from the platform interface layer:

Option A: Move MethodChannel* out of *_platform_interface (In-Place Pure Dart)
  • Move MethodChannelFirebase (package:flutter/services.dart) from firebase_core_platform_interface into the app-facing firebase_core package (or a dedicated firebase_core_method_channel subpackage).
  • Remove flutter: sdk: flutter and environment: flutter: from firebase_core_platform_interface/pubspec.yaml.
  • Pros: Zero new packages; *_platform_interface becomes 100% pure Dart immediately.
  • Cons: Technically a breaking change for external consumers or test suites that directly instantiate MethodChannelFirebase from firebase_core_platform_interface (requires scheduling for the next major version bump).
Option B: Extract Pure-Dart Leaf Package (package:firebase_common / *_interface)
  • Extract pure-Dart platform contracts and shared domain models (FirebaseAppPlatform, FirebaseOptions, FirebaseException, Timestamp, GeoPoint, etc.) into a zero-dependency pure-Dart package (e.g. package:firebase_common).
  • Have *_platform_interface re-export these types alongside MethodChannel*, while *_web packages depend directly on the pure-Dart package.
  • Pros: 100% backwards-compatible; requires no major version bump to existing *_platform_interface packages; enables code sharing with server-side firebase-admin-dart.
  • Cons: Introduces a new leaf package to publish and maintain in the monorepo.
Acceptance Criteria
  • Select preferred direction (Option A vs. Option B) for decoupling MethodChannel* (package:flutter/services.dart) from the pure-Dart interface layer.
  • Confirm whether pure-Dart platform interfaces should standardize exclusively on FirebaseException rather than catching/throwing PlatformException.
主要语言
Dart
星标
9.3k
派生
4.1k
平均合并
2 天 7 小时
30 天内合并 PR
47

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

firebase/flutterfire 的其他 Issue

查看 firebase/flutterfire 的全部 Issue

相似的 Issue

更多 Dart Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。