Cannot use parse flutter sdk package due to issue with idb and senbast
New Issue Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am not just asking a question.
- [x] I have searched through existing issues.
- [x] I can reproduce the issue with the latest version of Parse Server and the Parse Flutter SDK.
Issue Description
i am getting this ../../AppData/Local/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'); ^^^^^^^^^^^^^^^^^ ../../AppData/Local/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'; ^^^^^^^^ ../../AppData/Local/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'; ^^^^^^^^ ../../AppData/Local/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'); ^^^^^^^^^^^^^^^^^
heres my pubspec
description: "A new Flutter project."
The following line prevents the package from being accidentally published to
pub.dev using flutter pub publish. This is preferred for private packages.
publish_to: 'none' version: 1.0.0+1
environment: sdk: ^3.6.2
dependencies: flutter_screenutil: ^5.9.3 google_fonts: ^4.0.4 parse_server_sdk_flutter: ^9.0.0 skeletonizer: ^1.4.3 flutter: sdk: flutter
cupertino_icons: ^1.0.8
dev_dependencies: flutter_test: sdk: flutter
Steps to reproduce
Running a flutter web project with the flutter package 3.27.4, import the parse sdk flutter package
Actual Outcome
that error illustrated above. it doesnt run
Expected Outcome
it is meant to run without the error.
Environment
flutter sdk 3.27.4, dart version 3.6.2
Parse Flutter SDK
- SDK version: ^9.0.0
- Flutter version: 3.27.4
- Dart version: 3.6.2
- Operating system version: WIndows 10
Server
- Parse Server version:^9.0.0
Logs
Thanks for opening this issue!
- 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
Hi! I've been experiencing the same problem when compiling an app with parse_server_sdk_flutter for web. It's not happening with windows though. Any ideas here?
Hello, I've had the same issue, but I don't remember how I solved. Can you add minimum reproducable example?
Hello @Litesoulo , thanks for answering. Yes, of course. Let me share with you my project dependencies so you can take a look. I think that's enough to debug the issue, as the only problem here is inside parse_server_sdk_flutter library.
environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
path: any
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: any
go_router: ^14.2.0
get_it: ^7.7.0
oktoast: ^3.4.0
equatable: ^2.0.5
flutter_bloc: ^8.1.6
form_inputs:
path: packages/form_inputs
formz: ^0.7.0
parse_server_sdk_flutter: ^9.0.0
font_awesome_flutter: '>= 4.7.0'
rxdart: ^0.28.0
pdf: ^3.11.1
printing: ^5.8.0
path_provider: ^2.1.4
open_document: ^1.0.7
random_string: ^2.3.1
csv: ^5.0.0
file_picker: ^5.2.5
share_plus: 7.2.2
url_launcher: ^6.1.10
dependency_overrides:
intl: ^0.18.1
dev_dependencies:
flutter_test:
sdk: flutter
lint: ^2.3.0
flutter_lints: ^4.0.0
build_runner: ^2.4.11
flutter:
uses-material-design: true
# Enable generation of localized Strings from arb files.
generate: true
assets:
# Add assets from the images directory to the application.
- assets/
Here I can show you a compilation for windows environment, for example:
PS C:\Users\Manuel Luque\Documents\Personal projects\Flutter\graficaslarambla_facturas_app> flutter build windows
Building Windows application... 41,7s
√ Built build\windows\x64\runner\Release\graficaslarambla_facturas_app.exe
On the contrary, here is the problem with the web option:
PS C:\Users\Manuel Luque\Documents\Personal projects\Flutter\graficaslarambla_facturas_app> flutter build web
Target dart2js failed: ProcessException: Process exited abnormally with exit code 1:
../../../../AppData/Local/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';
^^^^^^^^
../../../../AppData/Local/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';
^^^^^^^^
../../../../AppData/Local/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');
^^^^^^^^^^^^^^^^^
Error: Compilation failed.
Command: C:\Users\Manuel Luque\Downloads\flutter\bin\cache\dart-sdk\bin\dart.exe compile js --platform-binaries=C:\Users\Manuel Luque\Downloads\flutter\bin\cache\flutter_web_sdk\kernel --invoker=flutter_tool
-Ddart.vm.product=true -DFLUTTER_WEB_USE_SKIA=true -DFLUTTER_WEB_USE_SKWASM=false -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/f73bfc4522dd0bc87bbcdb4bb3088082755c5e87/
--native-null-assertions --no-source-maps -o C:\Users\Manuel Luque\Documents\Personal projects\Flutter\graficaslarambla_facturas_app\.dart_tool\flutter_build\1c742b524c0f125026e4d1b88b7daf91\app.dill
--packages=C:\Users\Manuel Luque\Documents\Personal projects\Flutter\graficaslarambla_facturas_app\.dart_tool\package_config.json --cfe-only C:\Users\Manuel Luque\Documents\Personal
projects\Flutter\graficaslarambla_facturas_app\.dart_tool\flutter_build\1c742b524c0f125026e4d1b88b7daf91\main.dart
#0 RunResult.throwException (package:flutter_tools/src/base/process.dart:118:5)
#1 _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:344:19)
<asynchronous suspension>
#2 Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:201:5)
<asynchronous suspension>
#3 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:876:9)
<asynchronous suspension>
#4 Future.wait.<anonymous closure> (dart:async/future.dart:528:21)
<asynchronous suspension>
#5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:814:32)
<asynchronous suspension>
#6 Future.wait.<anonymous closure> (dart:async/future.dart:528:21)
<asynchronous suspension>
#7 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:814:32)
<asynchronous suspension>
#8 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:637:16)
<asynchronous suspension>
#9 WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:93:34)
<asynchronous suspension>
#10 BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:253:5)
<asynchronous suspension>
#11 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1558:27)
<asynchronous suspension>
#12 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#13 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:496:9)
<asynchronous suspension>
#15 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#16 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:431:5)
<asynchronous suspension>
#17 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:98:11)
<asynchronous suspension>
#18 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#19 main (package:flutter_tools/executable.dart:99:3)
<asynchronous suspension>
Compiling lib\main.dart for the Web... 38,7s
Error: Failed to compile application for the Web.
@ManuelLuRa Hello, I've just added: dependency_overrides: web: ^1.1.1 sembast_web: ^2.4.1 and it works. You can use it as a temporary solution
Thanks @honor864510 ! Working like a charm :)
Fixed in #1093.