dlutton / flutter_tts

Flutter Text to Speech package
MIT License
619 stars 258 forks source link

IOs build breaks trying to load dart:js from web package #395

Closed davidBarbieri closed 1 year ago

davidBarbieri commented 1 year ago

Hi.

I'm updating an old flutter app, and i keep getting an error when trying to run the build:

This is the error for IOS:

`Launching lib/main.dart on iPhone 14 Pro Max in debug mode... Running pod install... Running Xcode build... Xcode build done. 72.9s Failed to build iOS app Error (Xcode): ../../../.pub-cache/hosted/pub.dev/flutter_tts-3.6.3/lib/flutter_tts_web.dart:3:8: Error: Dart library 'dart:js' is not available on this platform.

Could not build the application for the simulator. Error launching application on iPhone 14 Pro Max. `

And this is the error when running Android:

`Running Gradle task 'assembleDebug'... ../../../.pub-cache/hosted/pub.dev/flutter_tts-3.6.3/lib/flutter_tts_web.dart:3:8: Error: Dart library 'dart:js' is not available on this platform. import 'dart:js' as js; ^ Context: The unavailable library 'dart:js' is imported through these packages:

package:timed_out => file:///Users/davidbarbieri/development/timed_out/timed_out/lib/injection_container.dart => package:timed_out => package:flutter_tts => dart:js
package:timed_out => file:///Users/davidbarbieri/development/timed_out/timed_out/lib/injection_container.dart => package:timed_out => package:flutter_tts => package:flutter_web_plugins => package:js => dart:js
package:timed_out => package:flutter_tts => dart:js
package:timed_out => package:flutter_tts => package:flutter_web_plugins => package:js => dart:js

........................... lots more lines here ........................

`

this is my flutter doctor:

`[✓] Flutter (Channel stable, 3.10.0, on macOS 12.6 21G115 darwin-x64, locale en-GB) • Flutter version 3.10.0 on channel stable at /Users/davidbarbieri/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 84a1e904f4 (5 days ago), 2023-05-09 07:41:44 -0700 • Engine revision d44b5a94c9 • Dart version 3.0.0 • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc1) • Android SDK at /Users/davidbarbieri/Library/Android/sdk • Platform android-33, build-tools 34.0.0-rc1 • ANDROID_HOME = /Users/davidbarbieri/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14C18 • CocoaPods version 1.11.3

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.37.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.4.1

[✓] Connected device (3 available) • iPhone 14 Pro Max (mobile) • C570C7A4-2827-4B50-B2B8-478EF23D20B4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 12.6 21G115 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92 ! Error: Failed to prepare the device for development. Please unlock and reconnect the device. (code 806)

[✓] Network resources • All expected network resources are available. `

Any idea how i can avoid this and ignore the web package?

Thanks

David

dlutton commented 1 year ago

@davidBarbieri does flutter clean followed by flutter pub get and running your project work for you?

davidBarbieri commented 1 year ago

Hi @dlutton ! No, i tired many times to no avail. Also consider that i'm trying to upgare the app from Flutter 1.1 to 3.1, but still this seems like the only package that also supports web, that is causing issues with dart.js

dlutton commented 1 year ago

@davidBarbieri is this still an issue? I have not been able to recreate it locally. Do you have your code setup in another repo where I can attempt to recreate the issue?

davidBarbieri commented 1 year ago

Hi @dlutton No it's not an issue anymore, i think and automatic import on multiple files erroneusly imported a class from the web part rather then the mobile packages. So this can be closed