i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Type 'HttpRequest' not found

Open siloebb opened this issue 5 years ago • 15 comments

I install the lib but when I try to run the app I got that error below. I think thar was I update the flutter to 1.17, I tried to clean the project and the cache.

`Launching lib/main.dart on SM N9600 in debug mode... Running Gradle task 'assembleDebug'...

Compiler message: ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:11:8: Error: Not found: 'dart:html' import 'dart:html'; ^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:28:10: Error: Type 'HttpRequest' not found. Future<HttpRequest> _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:28:46: Error: Type 'HttpRequest' not found. Future<HttpRequest> _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ Invalid depfile: /home/siloe/Developer/flutter/meditacao/.dart_tool/flutter_build/659e08df06b3af32a6baf6232e5f9259/kernel_snapshot.d Invalid depfile: /home/siloe/Developer/flutter/meditacao/.dart_tool/flutter_build/659e08df06b3af32a6baf6232e5f9259/kernel_snapshot.d

Compiler message: ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:11:8: Error: Not found: 'dart:html' import 'dart:html'; ^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:20:19: Error: The method 'HttpRequest' isn't defined for the class 'HttpRequestDataReader'.

  • 'HttpRequestDataReader' is from 'package:intl/src/http_request_data_reader.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart'). Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'. var request = HttpRequest(); ^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:28:46: Error: 'HttpRequest' isn't a type. Future<HttpRequest> _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:29:31: Error: 'HttpRequest' isn't a type. var completer = Completer<HttpRequest>(); ^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:28:10: Error: Type 'HttpRequest' not found. Future<HttpRequest> _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:28:46: Error: Type 'HttpRequest' not found. Future<HttpRequest> _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:20:19: Error: The method 'HttpRequest' isn't defined for the class 'HttpRequestDataReader'.
  • 'HttpRequestDataReader' is from 'package:intl/src/http_request_data_reader.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart'). Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'. var request = HttpRequest(); ^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:28:46: Error: 'HttpRequest' isn't a type. Future<HttpRequest> _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/src/http_request_data_reader.dart:29:31: Error: 'HttpRequest' isn't a type. var completer = Completer<HttpRequest>(); ^^^^^^^^^^^ 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) dart-lang/i18n#352 asFileUri (package:vm/kernel_front_end.dart:567:37) dart-lang/i18n#353 writeDepfile (package:vm/kernel_front_end.dart:760:21) dart-lang/i18n#354 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:536:15) dart-lang/intl#4 _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:40:22) dart-lang/i18n#355 starter (package:flutter_frontend_server/server.dart:178:27) dart-lang/intl#6 main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30) dart-lang/i18n#356 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32) dart-lang/i18n#357 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.

FAILURE: Build failed with an exception.

  • Where: Script '/home/siloe/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 882

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/home/siloe/flutter/bin/flutter'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 16s Exception: Gradle task assembleDebug failed with exit code 1`

siloebb avatar May 14 '20 18:05 siloebb

Did you use import 'package:intl/date_symbol_data_http_request.dart';? I solved this error withimport 'package:intl/date_symbol_data_local.dart';.

If you want to support both web and mobile then it may depend on another issue.

jeiea avatar Jun 10 '20 03:06 jeiea

I've encounter the same issue and importing the right intl dart file fix it :) Thank you @jeiea

BTW, I think this issue may be closed

PsyOhm23 avatar Feb 21 '21 22:02 PsyOhm23

I tried all the above steps and still getting the error! What's going on!?

premedios avatar Jul 06 '21 11:07 premedios

I decided to do the date formatting manually. I'm not recommending Fluttter/Dart to anyone!

premedios avatar Jul 06 '21 11:07 premedios

This is ridiculous, out of the blue i'm getting this error now.. none of my dependencies have changed, using dart 2.14 and flutter 2.5.3, and I can resolve and import html in my project files so not sure what the begeezus is going on.

devnullpointer avatar Dec 03 '21 18:12 devnullpointer

@devnullpointer , @premedios , could you add more details on the errors you are getting and if the above comment fixes them?

mosuem avatar Oct 19 '22 12:10 mosuem

I don't remember what I was doing when I got that error.

premedios avatar Oct 19 '22 13:10 premedios

Did a pub upgrade with the latest dart/flutter and dependencies and the issue cleared itself, must have been a combo of null-safety with no null safety libs interacting like a big conga line.

devnullpointer avatar Oct 19 '22 14:10 devnullpointer

Thanks for the quick feedback on this old issue! I will close it then.

mosuem avatar Oct 20 '22 05:10 mosuem

I had the same issue, one unwanted import was in my code. This import was the culprit "import 'package:intl/date_symbol_data_http_request.dart'". When I removed this import and got worked :)

SijuKJ avatar Nov 03 '22 18:11 SijuKJ

Thanks for the tip! Was this recently/with a recent Flutter version?

Unfortunately, I still can't reproduce the error. Reopening though.

mosuem avatar Nov 04 '22 12:11 mosuem

Did you use import 'package:intl/date_symbol_data_http_request.dart';? I solved this error withimport 'package:intl/date_symbol_data_local.dart';.

If you want to support both web and mobile then it may depend on another issue.

This should be in the docs.

e200 avatar Dec 30 '22 17:12 e200

image

不知道什么时候,我的main.dart里面多了这句import,导致我项目运行不起来,报错提示语同上,删除后问题就解决了。记录下

539863010 avatar Nov 10 '23 15:11 539863010

image 不知道什么时候,我的main.dart里面多了这句import,导致我项目运行不起来,报错提示语同上,删除后问题就解决了。记录下

开发平台ios&android

539863010 avatar Nov 10 '23 15:11 539863010

@539863010, running dart fix should get rid of the unnecessary imports. That the "right" library has to be imported should be documented better.

mosuem avatar Nov 13 '23 08:11 mosuem