Questions tagged [dart-html]
Dart HTML allows access to basic browser features like the DOM, FileSystem, Websockets and other things.
479
questions
42
votes
3
answers
62k
views
How to use setInterval/setTimeout in Dart SDK 0.4+
I realised that in current Dart SDK version 0.4.1.0_r19425 methods like setTimeout, setInterval, clearTimeout, clearInterval aren't part of Window class any more and they all moved to WorkerContext.
...
32
votes
1
answer
26k
views
Parsing a URI to extract query parameters, with Dart
I have a request in this form:
http://website/index.html?name=MyName&token=12345
Is there a way how to extract name and token from this url? There is always an option to iterate through all ...
26
votes
4
answers
25k
views
How to timeout a future computation after a timeLimit?
When defining a Future as follows:
Future<HttpRequest> httpRequest = HttpRequest.request(url,
method: method, requestHeaders: requestHeaders);
I want to handle a timeout after 5 secondes....
20
votes
1
answer
4k
views
How do I drive an animation loop at 60fps with Dart and the web?
How do I drive an animation loop or game loop at 60fps in a Dart web application?
18
votes
3
answers
17k
views
CORS with Dart, how do I get it to work?
Just started tinkering with Dart and I decided to write a simple Http Server and a client. My server code:
#import("dart:io");
final HOST = "127.0.0.1";
final PORT = 8080;
final LOG_REQUESTS = true;
...
14
votes
1
answer
7k
views
Get access to an object's property using bracket notation in dart
I try to do the following:
var properties = ["height" , "width"];
for (var prop in properties){
div.style[prop] = otherdiv.style[prop];
}
But dart doesn't seem to accept this bracket notation, is ...
9
votes
3
answers
11k
views
How can I print multiple objects to console.log with dart?
In javascript, if I have 3 variables like this:
var x = 1
var y = 'cat'
var z = {color: 'blue'}
I can log all of them like this:
console.log('The values are:', x, y, z)
In dart, you can import '...
9
votes
1
answer
6k
views
Get Variables name by it's value in Dart Lang
For Example, I have a variable like this.
var fooBar = 12;
I want a something like this in Dart lang.
print_var_name(fooBar);
which prints:
fooBar
How can I achieve that? Is this even possible?
...
8
votes
4
answers
1k
views
What's the difference between "dart:html" and "dart:dom" package?
I'm starting with some of the Dart examples. Then I wanted to query the DOM with document.query('#someId') as described here, but it seems there was no query method in document. Also creating a new ...
8
votes
6
answers
4k
views
Dart Removing disallowed attribute after editor upgraded
I have encounter error "Removing disallowed attribute" after I upgraded my dart editor in SDK 0.7.3.1_r27487.
I have a custom tag which template contains boostarp attributes "data-target" and "data-...
8
votes
1
answer
6k
views
Dart login/logout example
I'm trying to find a simple example of user authentication with Dart. So far the closest I've found is https://github.com/dart-lang/bleeding_edge/blob/master/dart/tests/standalone/io/http_auth_test....
8
votes
1
answer
4k
views
Add extra headers to websocket connection from browser in Dart
I'm trying to establish an authenticated websocket connection, and this question is a sibling to similar question for server part.
How I can add extra headers when I establish a websocket connection ...
7
votes
4
answers
2k
views
How to animate scrolling in Dart?
I want to make a smooth scrolling to a section of my page. In jQuery is done so:
$('html, body').animate({
scrollTop: $('#anchorOfMyTargetSection').offset().top
}, 'slow');
In Dart, I can make ...
7
votes
1
answer
1k
views
HTML Tags Within Internationalized Strings In Polymer.dart
I am displaying internationalized strings within a Polymer element as follows:
<div>
<span class="title">{{title}}</span>
<br/><br/>
<span class="subtitle">{{...
7
votes
1
answer
160
views
Changing App Layout Drawer persistent to temporary at media change in AngularDart
I have an App Layout of angular components in my AngularDart project. How can I change the drawer of App layout from persistent to temporary at the change of media screen?
6
votes
2
answers
21k
views
How to select template element by ID in Angular 2 Dart?
Relativley new to Angular and Dart I have the following problem:
my_component.dart:
import 'package:angular2/core.dart';
import 'package:angular2_components/angular2_components.dart';
import '...
6
votes
2
answers
2k
views
In Dart, if I listen to a click event with two listeners, how do I know which happens first?
If I write the following Dart code, how do I know which click handler happens first?
main() {
var button = new ButtonElement();
var stream = button.onClick.asBroadcastStream();
stream.listen(...
6
votes
1
answer
2k
views
How to get the HTTP response text from a HttpRequest.postFormData's catchError's _XMLHttpRequestProgressEvent?
Given the following pseudo code:
import "dart:html";
HttpRequest.postFormData(url, data).then((HttpRequest request) {
...
}).catchError((error) {
// How do I get the response text from ...
6
votes
1
answer
4k
views
Not found: 'dart:html' import 'dart:html'; I don't need dart:html and I also didn't used, but I tried by importing it, but the error isn't going
I'm writing a code in which I'm doing registration with firebase. And the data including Profile image is going to firestore. But the issue is I'm getting multiple errors which I'm not able to solve. ...
6
votes
1
answer
1k
views
How can I parse the contents of a PDF file in dart?
Is there a way I can parse the contents of PDF files into widgets or something more understandable or perhaps into something that can be modified and again converted to PDF format?
5
votes
3
answers
2k
views
How do I dynamically add a stylesheet using Dart?
I know in Javascript how to dynamically add a stylesheet.
This can be done using the following code:
var sheet = document.createElement('style');
But when I try the same using Dart (https://www....
5
votes
3
answers
29k
views
net::ERR_UNSAFE_PORT in dart
I am doing a server side dart code using notepad++, I have already succeed in server side dart code using dart editor. But I the same think where I done with notepad++ done a error as net::...
5
votes
1
answer
6k
views
WebView support for FlutterWeb for plugin development
Hi I developed a Flutter Plugin flutter_tex. It's based on the WebView. How do I add Flutter Web support for this??
I tried this example to show my HTML content.
import 'dart:ui' as ui;
void ...
5
votes
1
answer
518
views
Dart, float for loop will cause strange result
for(int i=0; i<10; i++) {
priceValue.add(54.99 + i*5);
print(54.99 + i*5);
}
Result:
js_primitives.dart:30 54.99
js_primitives.dart:30 59.99
js_primitives.dart:30 64.99000000000001
...
5
votes
1
answer
1k
views
Dart: Adding child elements to DivElement programmatically
Say I want to add a ButtonElement to a DivElement programmatically, such that the resultant HTML is:
<div class="blah">
<input type="button" name="whatever" value="Push Me!" />
</...
5
votes
1
answer
526
views
How to add HTML entities in Dart?
I want to add HTML entities like or & using a Dart class. I tried this :
my_element.nodes.add(new Text('&©'));
but as mentioned in Text class doc, markup is ...
5
votes
1
answer
2k
views
Return string from HttpRequest
In Dart I can do:
await HttpRequest.getString(path)
and this will return a string.
I want to create a method that will do the same, but like this:
HttpRequest request = new HttpRequest();
request
...
5
votes
1
answer
2k
views
How to make window.prompt in Dart?
I make some apps using Dart and I have one simple question. I haven't found the prompt dialog in dart:html library. I've found only alert and confirm dialog calls, but that's not, what I need. I've ...
5
votes
2
answers
3k
views
Assets Images not rendering in flutter-ios. How to render local asset-images inside html <img src...> tag in flutter without using webview?
Open issue at GitHub
I am using HTML/CSS to create PDF views. So, In some cases we need render images from the local asset-folder. When we try to render the file from assets folder image is not ...
5
votes
1
answer
877
views
Wait for a keypress in Dart
I'd like to pause execution of my Dart script (in a webpage) until the user hits a key. The following code works, but I'm wondering if there's any better way of doing it:
import 'dart:html';
import '...
5
votes
1
answer
531
views
How to use animationFrame in Dart?
The following code throws the exception "type '([int]) => void' is not a subtype of type 'RequestAnimationFrameCallback' of 'callback'."
import 'dart:html';
void main() {
window.animationFrame....
5
votes
1
answer
638
views
Export Dart classes and functions to javascript
If I want to use Dart to create a js library, how can I export Dart classes and functions for use in javascript?
Is there something similar to scala.js, like this?
@JSExport
class Hello{
num x = ...
4
votes
1
answer
7k
views
How to sort a MappedListIterable in Dart
I've got a MappedListIterable than I know to sort
When calling the sort method , I 'm getting
EXCEPTION: NoSuchMethodError: Class 'MappedListIterable' has no
instance method 'sort'. Receiver: ...
4
votes
2
answers
2k
views
Dart: "Invalid argument(s): Illegal character in path" when building on Windows
The offending line in my index.html file reads
<script src="main.dart" type="application/dart"></script>
The error report is:
Build error:
Transform polymer (...
4
votes
1
answer
3k
views
Dart: wait for callback before continuing
I was wondering whether it's possible to wait for a callback before continuing a process.
I'm using a library that handles a future internally and then if it was successful, does a callback, ...
4
votes
1
answer
413
views
Failed to load dartium when running test
I'm running dart test using test library.
pub run test -p dartium
When this command is executed I'm getting below error, I have dartium and dart sdk downloaded and in system path.
Failed to start ...
4
votes
3
answers
10k
views
How to make HTTPS request using HttpClient in dart?
I'm using HttpClient from dart (dart:io package, NOT dart:http) and I'd like to send an HTTPS request. Is there a way to do that? I can't seem to find a method that would allow me that.
4
votes
2
answers
413
views
Geolocation with Dart in Firefox getCurrentPosition not a function
I have written this code in Dart
window.navigator.geolocation.getCurrentPosition((Geoposition position) {
window.alert(position.coords.latitude.toString());
});
When I run it in Dantium or ...
4
votes
2
answers
1k
views
Get the width of custom element created using <polymer-element> in dart?
How do I get the width of a custom element from the element's script?
<polymer-element name="his-elem">
<div>
blah
</div>
</polymer-element>
@CustomTag('his-elem')
...
4
votes
2
answers
677
views
dart:io and dart:html being mutually exclusive
I've run into a similar situation to this chap where I'd like to have dart:io and dart:html in the same application. I know that dart:io is a server-side library and dart:html is a client side. My ...
4
votes
1
answer
658
views
Dart: How to fix the condition?
I'm a newbie. I create an angular application using the IDEA template and insert the code from the example:
<p *ngIf="true">
Expression is true and ngIf is true.
This paragraph is in ...
4
votes
2
answers
5k
views
DART post with multipart/form-data
in DART lang, how to specify POST request Content-Type to be
multipart/form-data
My DART code is:
sendDatas(dynamic data) {
final req = new HttpRequest();
req.onReadyStateChange.listen((Event e) {
...
4
votes
1
answer
3k
views
How to keep the Url parameters in Flutter web route path
I am building a flutter web app which requires a url parameter in the start.
Currently it needs a parameter like http://localhost:49844/?id=105897
But after the app catches the url it disappears (like ...
4
votes
1
answer
544
views
Billboarding in Dart WebGL
I've been trying to create billboarding effects for a game I'm making in dart using lwjgl.
I've been reading that you should have each billboard vertex is at the worlds center position and then just ...
4
votes
0
answers
6k
views
How do I fix: "Error: Dart library 'dart:html' is not available on this platform." in ios/android development Flutter?
Was testing a UI change on my android emulator with Flutter. Emulator crashed and I got this message:
"Error: Dart library 'dart:html' is not available on this platform.
lib/…/pages/sign_up.dart:...
4
votes
0
answers
160
views
How to use dart Future in js?
this is my sample programe:
import 'dart:html';
import 'package:js/js.dart';
import 'package:js/js_util.dart';
void main() {
setProperty(window, 'login', allowInterop(login));
}
Future<String&...
4
votes
0
answers
252
views
How to make XSL transforms in Dart
The XsltProcessor class from the dart:html library is deprecated.
What library should I use to make XSL transforms in Dart?
3
votes
2
answers
8k
views
Can i use two iframes on Flutter web?
I'm new in Flutter and i'm developing a little web page for learn.
I wanna put a google map and facebook feed using two iframe.
I base my code on Wangoo's code here:
https://medium.com/flutter-...
3
votes
1
answer
5k
views
How to upload a specific type of file with FileUploadInputElement in Flutter for Web
I was trying to create a simple file uploader for a project in flutter, meant to upload images on a Firebase storage bucket, but I can't find a way to select the file type.
I've read the not-so-...
3
votes
2
answers
728
views
dart web : couldn't run webdev
I installed webdev to run dart web but when I want to run webdev it's showing an error:
Building package executable...
Failed to build webdev:webdev:
../../.pub-cache/hosted/pub.dartlang.org/dds-2.1....