10

It's an app in production. I've changed some logic trying to obtain dateTime that I have localized changing it to another country, then suddenly there were some error saying something about dart html but I don't remember exactly what, so I tried to rebuild the project and it was complaining about using new build system and so far I tried:

  • changing the system to legacy
  • flutter clean
  • udate cocoapods.
  • remove podfile.lock
  • pod update
  • pod install
  • packages upgrade
  • flutter upgrade

None of theses did the work.

When changed to legacy there were like 13 errors one of them complaining that dart:html not found, so I've added it to dependencies and dev dev dependencies and still nothing. I also commented the intl package because I was using it when that happened and did packages get and nothing.

Any ideas how to deal with this?

Here is the full console Xcode's output:

>     2020-03-16 17:55:17.549 xcodebuild[56626:765857]  DTDeviceKit: deviceType from 3ad4f96e876e8222a72563420303530067367818 was NULL
>     ** BUILD FAILED **
> 
> 
> Xcode's output: ↳



  **Skipped Warnings about deprecated methods, because of char limits and previously builds despite the warnings.** 


> 
>     Compiler message:
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:11:8:
> Error: Not found: 'dart:html'
>     import 'dart:html';
>            ^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:6:8:
> Error: Not found: 'dart:html'
>     import 'dart:html';
>            ^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:10:
> Error: Type 'HttpRequest' not found.
>       Future<HttpRequest> _getString(String url, HttpRequest xhr) {
>              ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:46:
> Error: Type 'HttpRequest' not found.
>       Future<HttpRequest> _getString(String url, HttpRequest xhr) {
>                                                  ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:34:18:
> Error: 'HttpRequest' isn't a type.
>       final _xhrs = <HttpRequest>{};
>                      ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:20:23:
> Error: Method not found: 'HttpRequest'.
>         var request = new HttpRequest();
>                           ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:46:
> Error: 'HttpRequest' isn't a type.
>       Future<HttpRequest> _getString(String url, HttpRequest xhr) {
>                                                  ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:29:35:
> Error: 'HttpRequest' isn't a type.
>         var completer = new Completer<HttpRequest>();
>                                       ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:58:34:
> Error: 'Blob' isn't a type.
>           var blob = xhr.response as Blob ?? Blob([]);
>                                      ^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:46:15:
> Error: The method 'HttpRequest' isn't defined for the class
> 'BrowserClient'.
>      - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart').
>     Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'.
>         var xhr = HttpRequest();
>                   ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:58:42:
> Error: The method 'Blob' isn't defined for the class 'BrowserClient'.
>      - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart').
>     Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
>           var blob = xhr.response as Blob ?? Blob([]);
>                                              ^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:59:20:
> Error: The method 'FileReader' isn't defined for the class
> 'BrowserClient'.
>      - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart').
>     Try correcting the name to the name of an existing method, or defining a method named 'FileReader'.
>           var reader = FileReader();
>                        ^^^^^^^^^^
>     Unhandled exception:
>     FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml;
> message=StandardFileSystem only supports file:* and data:* URIs)
>     #0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
>     #1      asFileUri (package:vm/kernel_front_end.dart:604:37)
>     #2      writeDepfile (package:vm/kernel_front_end.dart:799:21)
>     <asynchronous suspension>
>     #3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:472:15)
>     <asynchronous suspension>
>     #4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:38:22)
>     #5      starter (package:flutter_frontend_server/server.dart:149:27)
>     #6      main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
>     #7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
>     #8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
> 
>     Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
>     Failed to build bundle.
>     Failed to package /Users/[user]/StudioProjects/[projectName]/ios/...
>     Command PhaseScriptExecution failed with a nonzero exit code
>     note: Using new build system
>     note: Planning build
>     note: Constructing build description
> 
> Could not build the precompiled application for the device.
> 
> Error launching application on [user].

EDIT: I also have "platform :ios, '11.0'" in my Podfile and iOS Deployment Target set to 11.0 on Pods settings.

EDIT 2: Here are the packages I use:

dependencies: flutter: sdk: flutter

flutter_localizations: sdk: flutter

flutter_cupertino_localizations: ^1.0.1

geoflutterfire: ^2.0.3+5

firebase_storage: ^3.0.6

cloud_firestore: ^0.12.9+6

firebase_core: ^0.4.0+9

firebase_auth: ^0.14.0+5

firebase_messaging: ^6.0.9

firebase_database: ^3.0.7

firebase_admob: ^0.9.0+7

flutter_facebook_login: ^3.0.0

font_awesome_flutter: ^8.5.0

image_picker: ^0.6.1+11

image: ^2.1.4

rxdart: ^0.22.1

location: ^2.3.5

google_maps_flutter: ^0.5.20+1

geocoder: ^0.2.1

google_sign_in: ^4.0.11

provider: ^4.0.4

flutter_inapp_purchase: ^2.0.4

http: ^0.12.0+4

url_launcher: ^5.2.5

intl: ^0.16.0

cloud_functions: ^0.4.1+4

apple_sign_in: ^0.1.0

flutter_signin_button: ^1.0.0

json_annotation: ^3.0.1

notification_permissions: ^0.4.4

html_unescape: ^1.0.1+3

cupertino_icons: ^0.1.2

dev_dependencies: flutter_test: sdk: flutter build_runner: ^1.7.3 json_serializable: ^3.2.5

1 Answer 1

5
+100

The intl package needs to be properly configured to work on Flutter.

When you import it, DON'T use the import 'package:intl/intl_browser.dart';, insead use the follwing (each one has its use so see the docs the one that best suits you):

import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
import 'package:intl/intl_standalone.dart';
Sign up to request clarification or add additional context in comments.

6 Comments

I'm not using dart:html... It's a part of the intl and some other packages. I just started new project from scratch, using the same packages and it compiles fine. I have no idea what went wrong with this one... One thing I know for sure is I have no intend to make a web app and this "browser_client.dart:6:8:" is used only for web apps, so the error is something in this direction, but I have no idea what happened. I tried flutter config --no-enable-web... just in case I enabled the web somehow, but still doesn't work.
Have you configured the intl package correctly? You have to import it the right way otherwise it loads the Browser version, how does your intl imports look like? Are you using import 'package:intl/intl_browser.dart';?
no I don't but I saw this import 'package:intl/date_symbol_data_http_request.dart'; and I wasn't using it. I commented it and now get this error flutter dyld: Library not loaded: @rpath/AppAuth.framework/AppAuth so I have to find a way to get rid of it to see if there were a problem with the import.
Also check if you are using the latest version of the intl library and do a flutter clean.
Ok thanks, I’ll give it a try tomorrow, and let you know if it works
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.