Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

Pull Request

Issue

Closes: #1034

Approach

Flutter Web builds fail due to the Database class being defined in both idb_shim and sembast packages, causing an ambiguous import error:

Error: 'Database' is imported from both 'package:idb_shim/idb.dart' and 'package:sembast/src/api/v2/database.dart'.

The older sembast_web (^2.2.0) depends on idb_shim versions that have this name collision. Updated dependencies to versions where this is resolved:

  • sembast: ^3.6.0^3.7.4
  • sembast_web: ^2.2.0^2.4.0

Applied to both packages/dart/pubspec.yaml and packages/flutter/pubspec.yaml.

Tasks

  • Add tests (no new tests needed - dependency version update only)
  • Add changes to documentation (guides, repository pages, code comments) (no documentation changes needed)
Original prompt

This section details on the original issue you should resolve

<issue_title>Flutter Web build fails with ambiguous import from sembast and idb_shim</issue_title>
<issue_description>### New Issue Checklist

Issue Description

Compiling a Flutter web application fails due to a name collision in transitive dependencies (sembast and idb_shim). The compiler throws an error because the class Database is defined in both packages, leading to an ambiguous import.

Steps to reproduce

  1. Create a new Flutter project (flutter create my_app).
  2. Add parse_server_sdk_flutter: ^9.0.0 to the pubspec.yaml file.
  3. Run flutter pub get.
  4. Attempt to compile for the web platform: flutter run -d web-server.
  5. The build process fails during compilation.

Actual Outcome

/home/rafgui/.pub-cache/hosted/pub.dev/idb_shim-2.3.2/lib/utils/idb_import_export.dart:9:1: Error: 'Database' is imported from both 'package:idb_shim/idb.dart' and 'package:sembast/src/api/v2/database.dart'.
import '../idb_client.dart';
^^^^^^^^
/home/rafgui/.pub-cache/hosted/pub.dev/idb_shim-2.3.2/lib/src/sembast/sembast_factory.dart:10:1: Error: 'Database' is imported from both 'package:idb_shim/idb.dart' and 'package:sembast/src/api/v2/database.dart'.
import 'package:sembast/sembast_memory.dart';
^^^^^^^^
/home/rafgui/.pub-cache/hosted/pub.dev/idb_shim-2.3.2/lib/src/sembast/sembast_factory.dart:97:11: Error: 'DatabaseException' is imported from both 'package:idb_shim/src/database_exception.dart' and
'package:sembast/src/api/exception.dart'.
throw DatabaseException('getDatabaseNames not supported');
^^^^^^^^^^^^^^^^^
Unhandled exception:
Unsupported operation: Unsupported invalid type InvalidType() (InvalidType). Encountered while compiling file:///home/rafgui/.pub-cache/hosted/pub.dev/idb_shim-2.3.2/lib/utils/idb_import_export.dart, which
contains the type: FunctionType(Future<Map<dynamic, dynamic>> Function()).
parse-community/Parse-SDK-Flutter#0 LibraryCompiler._typeCompilationError (package:dev_compiler/src/kernel/compiler_new.dart:4451)
#1 LibraryCompiler._emitType (package:dev_compiler/src/kernel/compiler_new.dart:4416)
#2 LibraryCompiler._emitFunctionTagged (package:dev_compiler/src/kernel/compiler_new.dart:4263)
#3 LibraryCompiler._emitLibraryMembers (package:dev_compiler/src/kernel/compiler_new.dart:4033)
#4 LibraryCompiler._emitLibrary (package:dev_compiler/src/kernel/compiler_new.dart:1313)
#5 LibraryCompiler.emitLibrary (package:dev_compiler/src/kernel/compiler_new.dart:926)
#6 LibraryBundleCompiler.emitModule (package:dev_compiler/src/kernel/compiler_new.dart:163)
#7 IncrementalJavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:300)
#8 FrontendCompiler.writeJavaScriptBundle (package:frontend_server/frontend_server.dart:898)

#9 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:708)

#10 listenAndCompile. (package:frontend_server/frontend_server.dart:1423)

The Dart compiler exited unexpectedly.
Waiting for connection from debug service on Web Server... 18.8s
Failed to compile application.

Expected Outcome

The application should compile and run successfully for the web platform without any dependency conflicts.

Environment

Parse Flutter SDK

  • SDK version: 9.0.0
  • Flutter version: 3.35.5
  • Dart version: 3.9.2
  • Operating system version: Linux (Raspberry Pi OS)

Server

  • Parse Server version: 8.2.5

Logs

The relevant compilation error logs are included in the "Actual Outcome" section above.
</issue_description>

<agent_instructions>Check whether this issue still exists and if so, fix it.</agent_instructions>

Comments on the Issue (you are @copilot in this sec...


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link

coderabbitai bot commented Dec 4, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

…endencies

Update sembast from ^3.6.0 to ^3.7.4+2 and sembast_web from ^2.2.0 to ^2.4.0+4
to fix the ambiguous import of Database class between idb_shim and sembast packages.

Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Flutter Web build failure from ambiguous import Fix Flutter Web build failure with ambiguous import from sembast and idb_shim Dec 4, 2025
Copilot AI requested a review from mtrezza December 4, 2025 05:44
Copilot finished work on behalf of mtrezza December 4, 2025 05:44
@mtrezza mtrezza changed the title Fix Flutter Web build failure with ambiguous import from sembast and idb_shim fix: Flutter Web build failure with ambiguous import from sembast and idb_shim Dec 4, 2025
@parse-github-assistant
Copy link

parse-github-assistant bot commented Dec 4, 2025

🚀 Thanks for opening this pull request!

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.75%. Comparing base (dd139ec) to head (6bd7e4d).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1093   +/-   ##
=======================================
  Coverage   43.75%   43.75%           
=======================================
  Files          61       61           
  Lines        3588     3588           
=======================================
  Hits         1570     1570           
  Misses       2018     2018           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mtrezza mtrezza marked this pull request as ready for review December 4, 2025 05:59
Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Why are the build numbers necessary in the range specifications?

Changed sembast from ^3.7.4+2 to ^3.7.4 and sembast_web from ^2.4.0+4 to ^2.4.0

Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
#Database
sembast: ^3.6.0
sembast_web: ^2.2.0
sembast: ^3.7.4+2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're not necessary. The build numbers were just the specific versions I referenced when analyzing the fix. Removed them in 6bd7e4d - now using ^3.7.4 and ^2.4.0.

Copilot AI requested a review from mtrezza December 4, 2025 06:06
Copilot finished work on behalf of mtrezza December 4, 2025 06:06
@mtrezza mtrezza merged commit 71aa5f2 into master Dec 4, 2025
13 checks passed
parseplatformorg pushed a commit that referenced this pull request Dec 4, 2025
# [dart-v9.4.3](dart-9.4.2...dart-9.4.3) (2025-12-04)

### Bug Fixes

* Flutter Web build failure with ambiguous import from `sembast` and `idb_shim` ([#1093](#1093)) ([71aa5f2](71aa5f2))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version dart-v9.4.3

parseplatformorg pushed a commit that referenced this pull request Dec 4, 2025
# [flutter-v10.6.2](flutter-10.6.1...flutter-10.6.2) (2025-12-04)

### Bug Fixes

* Flutter Web build failure with ambiguous import from `sembast` and `idb_shim` ([#1093](#1093)) ([71aa5f2](71aa5f2))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version flutter-v10.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter Web build fails with ambiguous import from sembast and idb_shim Cannot use parse flutter sdk package due to issue with idb and senbast

3 participants