Initialize list of lists in Dart

I have a grid in Dart implemented as follows: class Cell { int row; int col; Cell(this.row, this.col); } class Grid { List<List<Cell>> rows = new List(GRID_SIZE); Grid() { rows.fillRange(0, rows.length, new ...
more »

2017-04-14 16:04 (1) Answers

Dart JS interop for library using jQuery

I am attempting to use Dart's package:js to create an interop library for JScrollPane, which is wrapped with jQuery. Here's what I have so far: @JS() library jscrollpane; import 'dart:html'; import 'package:js/js.dart'; @JS() @anonymous abstra...
more »

2017-04-13 23:04 (1) Answers

Dart SqlJocky - No response from the database

I am currently trying to setup a database connection between my server (command line server) and my localhost xampp mysql. this is running in my main function: main() async { var pool = new ConnectionPool( host: 'localhost', port: 1234, us...
more »

2017-04-12 10:04 (0) Answers

How to open a PopupMenuButton?

How do I open a popup menu from a second widget? final button = new PopupMenuButton( itemBuilder: (_) => <PopupMenuItem<String>>[ new PopupMenuItem<String>( child: const Text('Doge'), value: 'Doge'), ...
more »

2017-04-11 16:04 (3) Answers

Pass a typed function as a parameter in Dart

I know the Function class can be passed as a parameter to another function, like this: void doSomething(Function f) { f(123); } But is there a way to constrain the arguments and the return type of the function parameter? For instance, in this...
more »

2017-04-11 02:04 (3) Answers

Dart - HttpRequest.getString() return JSON

I am trying to return the raw JSON from my server path (I use rpc for the API) with a Closure, because I want to keep it in the same function instead of using .then() and calling another one. This is my code: GetEntryDiscussionsFromDb(){ var url ...
more »

2017-04-10 12:04 (1) Answers

AngularDart - Use Form Action

I am trying to use a form action attribute in AngularDart to redirect to the specified url. In plain html I would do something like this: <form action="http://localhost:8082" method="GET"> <select name="q"> <option value=...
more »

2017-04-07 19:04 (1) Answers

Custom archetypes for AngularJS (Dart)

Is there something like Maven Archetypes for AngularJS (Dart)? Update: I looked into Stagehand (as mentioned by Günter Zöchbauer), but it only supports standard templates. Unfortunately, I can't create my own templates. ...
more »

2017-04-05 13:04 (0) Answers

dependency injection for interfaces

I have a component which contains a generic popup, it implements therefore the interface PopupParent @Injectable() @Component( //... ) class SubjectListComponent implements OnInit, PopupParent { } The generic class InfoPopup needs to deal abst...
more »

2017-04-03 15:04 (1) Answers

AngularDart - upload to shared hosting server

so I have my AngularDart app up and running on my machine (I used stagehand). Now is the time where I want to upload it to a shared hosting server. My question is: what is the correct procedure to do that? Because obviously Dart doesn't run natively ...
more »

2017-04-03 00:04 (1) Answers

Can I inject a service into CanActivate?

Unlike the other hooks, CanActivate is a function separated from the component. import 'dart:async'; import 'package:angular2/core.dart'; import 'package:angular2/router.dart'; @Component(selector: 'my-app', template: '<h1>Hello World!</h1...
more »

2017-04-02 10:04 (1) Answers

inject Image without removing src attribute

is there a way to inject HTML without filtering the src attribute in Dart (no security needed in context), I've tried setInnerHtml, but it doesn't let src pass it... here's the div I'm adding html in: <div id="output"> <!--here goes me...
more »

2017-04-02 05:04 (1) Answers

How to make ViewChild work in a unit test

I have a test like @Component( selector: 'my-test', template: 'none', changeDetection: ChangeDetectionStrategy.OnPush, ) class MyTestComponent { final AngularClientCache clientCache; MyTestComponent(this.clientCache) { assert(clientCac...
more »

2017-03-31 18:03 (1) Answers

AngularDart - Manipulate DOM from Component

so I am using the standard template from AngularDart that comes from stagehand web-angular-simple. Now, if I have something hardcoded in index.html and try to manipulate it from main.dart using querySelector, everything works fine. But how can I use...
more »

2017-03-31 17:03 (1) Answers

Increment enum or set enum value by index

I have an enum type: enum Day {sunday, monday, tuesday...} and a variable: Day day = Day.sunday; I would like to be able to increment the day. something like this: day++; // this would be wonderful day = Day.getByIndex(day.index + 1); // somet...
more »

2017-03-31 05:03 (1) Answers

Dart Test client- side HTML configuration

I understand that the package:unittest/unittest.dart is deprecated and the new package is package:test/test.dart. Which are the equivalent of the library package:unittest/html_config.dart and the useHtmlConfiguration() function in the new test.dart ...
more »

2017-03-29 19:03 (1) Answers