96,236 questions
3
votes
2
answers
1k
views
Dart project with more than one main HTML file
I'm using Dart to build some functionality for an intranet site, and I'm wondering what the best way to organize a project with two "pages" in it is. Questions like this one, suggest that the (only) ...
6
votes
1
answer
396
views
How do I access `this` from JavaScript via JS - Dart interop?
I need to access a JavaScript object's this from a Dart function. I'm effectively adding a new method to a JavaScript object, via Dart-JS interop. I need to access properties that are on the ...
0
votes
1
answer
2k
views
STOMP client for Chrome Apps
I'm trying to build a STOMP library that can be used to connect to RabbitMQ from chrome apps. My initial experiments from outside chrome worked well. However, I'm unable to convert the Socket code to ...
2
votes
1
answer
841
views
What is the relationship among Rikulo UI, Rikulo Gap and Bootjack?
Can I use them separately? Can I use them with other solutions such as polymer?
3
votes
1
answer
230
views
Why does `pub install` keep creating `packages` link in all the subdirs of `web`?
I have a web dir, which contains some css and js files:
├── bootstrap-wysiwyg
│ ├── index.html
│ ├── packages -> ../../packages
│ └── republish.sh
├── css
│ ├── bootstrap-combined.no-icons....
6
votes
2
answers
1k
views
Where is `dart:uri` now?
I want to call decodeUrl(...) and I was doing it as:
import "dart:uri";
main() {
decodeUrl("str");
}
But now with the latest Dart-SDK, it reports:
Do not know how to load 'dart:uri'
import '...
0
votes
1
answer
2k
views
Enable TLS on open socket (STARTTLS)
Looks like SSL/TLS support has recently been added to Dart via the SecureSocket class, which is great.
So, for example this
SecureSocket.connect(_host, _port).then(
(Socket socket) {
...
2
votes
1
answer
484
views
sublime text 2 dart build error
I have configured sublime text 2 according to this video from Dart site. I have added this "dartsdk_path": "/home/green/dart/dart-sdk", to the Preference -> Setting-user. The syntax highlighting and ...
3
votes
1
answer
456
views
How do I overloading operators to allow 2 * A in dart?
I would like to implement a type A where I can write 2 * a. Is there anyway to overload operators so that this is possible in dart?
7
votes
3
answers
4k
views
Any UI control framework for DART? [duplicate]
I've just read about web ui framework for Dart but I havent seen any control for example datagrid or tab bar.
Is there any library providing components like these ones from Sencha ExtJs?
3
votes
1
answer
439
views
Is it possible to get a class mirror by name?
Suppose I have defined a library app with some classes:
library app;
class User {
// some members
}
class Question {}
class Answer {}
Is it possible to get the mirrors of class specified by ...
6
votes
1
answer
2k
views
Can't visit static variable of parent class in Dart?
Dart code:
main() {
print(PPP.name);
print(CCC.name);
}
class PPP {
static String name = "PPP";
}
class CCC extends PPP {
}
It prints:
PPP
Unhandled exception:
No static getter 'name' ...
3
votes
1
answer
81
views
How to get the name of type parameter?
Dart code:
main() {
var x = new X();
x.go();
}
class M<T> {
go() {
print(T); // !!!! can't be compiled
}
}
class X extends M<X> {
}
You can see in the method ...
3
votes
1
answer
962
views
I import another file by `import 'models.dart';`, it can't be compiled
I have defined many dart files in my project, and they imported another file by import:
controller.dart
import 'models.dart';
// dart code
app.dart
import 'models.dart';
import 'controller.dart';
...
0
votes
1
answer
545
views
Async/await pattern in Dart? [duplicate]
Does Dart have anything remotely similar to the async/await pattern in .net?
For example, I want to open a socket and do several handshakes: send 1, wait for response 1, send 2, wait for response 2 ...
36
votes
2
answers
34k
views
What is the dart function type syntax for variable declaration?
I know you can specify function types in formal arg list, but how would I do this for instance variables? I would like to do this:
class A<T> {
int compare(T a, T b);
}
where compare is a ...
1
vote
1
answer
461
views
What's so special about optional typing in dart
What's so special about "optional typing"?
People are very enthusiastic about Dart supporting "optional typing", but once a language supports duck typing - can't I take optional typing for granted? ...
0
votes
2
answers
207
views
Dart operator + doesn't work
I read in http://api.dartlang.org/ that there should be a String operator +
abstract String operator +(String other)
Creates a new string by concatenating this string with other.
For some reason it ...
8
votes
3
answers
9k
views
Dart vs JavaScript - Are they compiled or interpreted languages?
Is Dart considered to be a compiled or an interpreted language?
The same question holds for JavaScript.
The reason for the question:
I've been watching an interview with the founders of dart, and ...
1
vote
1
answer
301
views
Which dart2js command is launched by DartEditor?
After reading article found at https://www.dartlang.org/articles/web-ui/tools.html, I tried to compile my application by following it.
My application stored in web/app.html can be successfully ...
0
votes
1
answer
54
views
For the life of me I cant get the input to accept anything in the Game Of Darts tutorial for adding stuff to the dom
I have been researching for a while, At first my own code would not work so I tried the one provided and still when I try to enter a item into the list, nothing happens. No text is added or deleted ...
1
vote
1
answer
1k
views
Error doing a post from a dart app to a laravel 4 api using CORS
I have a REST API developed using Laravel 4. The client is written using Dart Language.
When my Dart app does a GET it all works fine, but when it does a post I get this error:
XMLHttpRequest ...
2
votes
1
answer
346
views
What is the use of observable function in Dart?
I understand that an @observable variables or properties will be able to get in sync with the HTML counterpart when the value of either one changes.
What I don't get is the purpose/significance of @...
2
votes
1
answer
286
views
Wrap an Element around another Element
Is there an easy way to wrap an Element, as there is in jQuery ( .wrap() ).
Example:
In jQuery:
$('.inner').wrap('<div />');
What I'm looking for in Dart:
query('.inner').wrap(new ...
0
votes
1
answer
252
views
Web app to a packaged app with Dart
I've been struggling with this for a few hours now. I've looked around and I believe I'm doing everything correctly, but it's just not working. Just for fun, I'm taking the sample Dart stopwatch and ...
1
vote
2
answers
197
views
If I know the name of a function, is it possible to get its parameters?
Dart code:
void hello(String name) {
print(name);
}
main() {
var funcName = "hello";
// how to get the parameter `String name`?
}
Using the function name as a string, "hello", is it ...
3
votes
1
answer
157
views
If and How to publish application packages to pub?
I understand that I can publish my packages,
and every project including a pubspec file is automatically a package.
When I want to publish my application package it tell's me, I need a 'lib' folder,...
1
vote
1
answer
264
views
Understanding exception handling mechanism (control flow) in Dart
Assume we have this Dart code:
void main() {
try {
try {
throw null;
} catch(e) {
throw null;
} finally {
print('first');
}
} finally {
print('second');
}
...
99
votes
13
answers
73k
views
is there any way to cancel a dart Future?
In a Dart UI, I have a button submit to launch a long async request. The submit handler returns a Future. Next, the button submit is replaced by a button cancel to allow the cancellation of the whole ...
70
votes
8
answers
44k
views
How can I get the name of a file in Dart?
I found I can't get the name of a file in a simple way :(
Dart code:
File file = new File("/dev/dart/work/hello/app.dart");
How to get the file name app.dart?
I don't find an API for this, so what ...
5
votes
3
answers
19k
views
@override of Dart code
I noticed PetitParserDart has a lot of @override in the code, but I don't know how do they be checked?
I tried IDEA dart-plugin for @override, but it has no effect at all. How can we use @override ...
0
votes
1
answer
128
views
How to create plugin?
I know how to create plugin in jQuery
(function($) {
$.fn.pluginName = function(options) {
// Establish our default settings
var settings = $.extend({
opt1 : 'value',
...
3
votes
1
answer
99
views
Extending a factory
I have two classes
class A {
String _id;
static final Map<String, A> _instances = <String, A>{};
factory A.getInstance(String id){
if(!_instances....
10
votes
1
answer
4k
views
Transform data when parsing a JSON string using Dart
I'm using the parse() function provided in dart:json. Is there a way to transform the parsed data using parse()? I'm thinking of something similar to the reviver argument when parsing JSON using ...
2
votes
2
answers
168
views
Where should I put my dart files if they are the server side files of restful api providers?
I'm trying to use start to write some restful apis for clients.
The content is looking like:
import 'package:start/start.dart';
import 'myfile1.dart';
import 'myfile2.dart';
import 'myfile3.dart';
...
0
votes
1
answer
1k
views
Why can't I run a dart file inside a dir?
I have a simple dart project, it has file structure like:
darttest tree
.
├── packages
│ ├── browser -> /Users/freewind/.pub-cache/hosted/pub.dartlang.org/browser-0.5.20/lib
│ ├── meta -> /...
2
votes
0
answers
213
views
Build of multiple entry point files in Dart have error as one has no init_autogenerated function defined
My app consists of two very similar entry point files, namely 'web/country_config.html', 'web/hotel_amenity_config.html'. Their HTML structure and logic are the same. The only difference lies in data. ...
0
votes
1
answer
2k
views
Dart bind JsonObject error: type 'List<dynamic>' is not a subtype of type 'JsonObject' of 'value'
I have a main GLTkComponent
============= xgltk.dart GLTkComponent.dart ==================================
@observable
class GLTkComponent extends WebComponent {
ObservableList<JsonObject> ...
0
votes
2
answers
671
views
how to deploy your dart app (using Web ui) without using Pub Deploy
What is the best strategy to deploy a Dart Web-ui app manually ?
pub deploy doesn't work for me and I have raised bug report. So am thinking what is the best way to manually deploy.
This is how I ...
-1
votes
1
answer
229
views
It is planned in Dart language adding functionality to declaring closures (without using typedef) as typed functions?
Closures in Dart language used very often because they very powerful.
I want ask question about closures usability.
Assume this source code:
class SomeWork<T> {
Function _test;
SomeWork(...
1
vote
1
answer
159
views
Can dart templating handle recursive mixed structures?
I'm entirely new to Dart so excuse my ignorance.
Lets say I was trying to model a tree which had frames and paragraphs. A frame could hold paragraphs, and other frames (recursive). (Note: These ...
4
votes
3
answers
1k
views
How to restart a dart server which file changes?
I'm running a web server with dart, it starts by:
dart server.dart
When I modified the project files, I hope this server can be restarted automatically. Is there any way to do it? Or is there any ...
2
votes
1
answer
822
views
How to prevent function return result declaratively?
Assume such conditions:
Some operation does not provide possibility of returning the result.
This operation declared as callback
Using typedef not recommended
Some operation provide of returning the ...
6
votes
0
answers
654
views
Why anonymous classes aren't included in languages such as C# and Dart? [closed]
I write a lot of code in Java, and always use anonymous classes. They allows you write concise code without boilerplate.
However, many modern languages, like C# and Dart don't include them. Why they ...
6
votes
1
answer
2k
views
Dart's Web Component vs Angular's Directive
Dart's Web Component and Angular's Directives look like they serve very similar purposes. Are there any significant differences?
4
votes
1
answer
436
views
when opening a HttpRequest I get this error: 2 positional arguments expected, but 5 found
I have written a function to submit a form to a REST API. Here is the code:
HttpRequest request;
void submitForm(Event e) {
e.preventDefault(); // Don't do the default submit.
request = new ...
2
votes
1
answer
167
views
Creating an element in a namespace in Dart
I am trying to create an element in a particular namespace in Dart. Is this the best way to do it:
document.$dom_createElementNS(namespace, tag);
Documentation here.
Additionally is there a ...
7
votes
2
answers
1k
views
When declare an local variable, it's better to declare the type or just use `var`, in Dart?
In dart, there is a var which means dynamic type.
When declare an local variable, I can write:
String name = "Freewind";
or
var name = "Freewind";
At first I thought they are the same, since the ...
2
votes
2
answers
152
views
I cannot understand the effectiveness of an algorithm in the Dart SDK
I cannot understand the effectiveness of an algorithm in the Dart SDK.
Here is the algorithm (List factory in dart:core, file list.dart)
factory List.from(Iterable other, { bool growable: true }) {
...
0
votes
1
answer
114
views
Sending a list of HttpRequest(s) to the same URL
When I write this Dart code :
for(int i=0;i<nbAleas;i++){
HttpRequest request=new HttpRequest();
// end of request event
request.onReadyStateChange.listen((_) {
if (request....