dart-lang / i18n

A general mono-repo for Dart i18n and l10n packages.
BSD 3-Clause "New" or "Revised" License
58 stars 37 forks source link

Type 'HttpRequest' not found #95

Open siloebb opened 4 years ago

siloebb commented 4 years ago

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 _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 _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'.

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

FAILURE: Build failed with an exception.

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

jeiea commented 4 years ago

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.

PsyOhm23 commented 3 years ago

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

premedios commented 3 years ago

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

premedios commented 3 years ago

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

devnullpointer commented 2 years ago

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.

mosuem commented 1 year ago

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

premedios commented 1 year ago

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

devnullpointer commented 1 year ago

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.

mosuem commented 1 year ago

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

SijuKJ commented 1 year ago

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

mosuem commented 1 year ago

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

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

e200 commented 1 year ago

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.

539863010 commented 8 months ago
image

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

539863010 commented 8 months ago
image

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

开发平台ios&android

mosuem commented 8 months ago

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