Stream

Join this community to post or comment

Danny Tuppeny

Discussion  - 
 
How can I interop with existing JS objects?

I'm trying to write Dart code that will generate a rough equivalent of this:

var disposable = vscode['commands'].registerCommand(
'extension.sayHello',
function () {
vscode['window'].showInformationMessage('Hello World!');
}
);
context.subscriptions.push(disposable);

The variables vscode and context are both globals available in the JavaScript which is executing my Dart (which is being compiled to JS with the Dart Dev Compiler).

I'm happy for context/vscode to be completely untyped for now, but I'm struggling to bend the JS package to output code like this (eg. if I put @JS() on a stub vscode, I get dart.global.vscode which seems to be null).
2
Matan Lurey's profile photoLunix Watt's profile photo
4 comments
 
If ever debugging using dart2js, 3 rules of thumb:
1. Disable minification, always.
2. Enable source maps both in Chrome & in Dart.
3. Enable checked mode.

Normally, already a lot of errors would get clearer. Even Dart stdlib is in the source map.
Add a comment...

Kasper Peulen

Discussion  - 
 
Turns out, you don't really need any library to do Redux in Dart! Here is the proof :) The famous redux counter example in DartPad:

https://dartpad.dartlang.org/0afd663921c95a2376de64775d052a27
New Pad… Reset… Share… Samples, Bootstrap, Fibonacci, Hello World, Hello World HTML, Solar, Spirodraw, Sunflower, WebSockets. Dart; HTML; CSS. Run. HTML Output; Console. Privacy policy Send feedback. Strong mode (What's this?)
21
1
Add a comment...

Luis Vargas

Announcements  - 
 
This is the first release of ng_bootstrap for dart
https://pub.dartlang.org/packages/ng_bootstrap
ng_bootstrap - Angular 2 and Bootstrap 4
18
2
Filip Hráček's profile photoLuis Vargas's profile photo
2 comments
 
Next Version I'll try to do that
Add a comment...

Adrián Avila

Discussion  - 
 
I made an article of how to create dialogs that return a result w/o the need of using CSS, here it is:

https://medium.com/@adrian.avila.mtz/dialogs-in-dart-w-o-css-ed84d734045f#.4k45tb8wb
6
Add a comment...

Hannes Rammer

Discussion  - 
3
Add a comment...

Rudy Reeves

Discussion  - 
 
Let's contribute to StackOverflow's dart Documentation page!
17
1
Add a comment...

Danny Tuppeny

Discussion  - 
 
I've been porting some C# code that posts tweets to Dart, but I'm struggling on encoding the characters correctly when generating the signature.

In C# I had to try a few different methods before I found the correct one, but in Dart none of those I can find encode correctly.

Any ideas? Dartpad link included in the SO question.
4
Danny Tuppeny's profile photo
8 comments
 
I sent a PR that extends the tests and (I believe) fixes this issue :)

https://github.com/dart-lang/convert/pull/4

+Natalie Weizenbaum 
Add a comment...

Nathan Kerr

Announcements  - 
 
I just published a tutorial about creating a JavaScript interoperability library. The new package:js is great, but there's not nearly enough info about it.

“Creating a Dart-to-Javascript interop library"

https://medium.com/@thebosz/creating-a-dart-to-javascript-interop-library-c97da204c34a
With my game, I’ve been working on creating a set of libraries to easily use Cordova plugins from Dart. I’m using the new “package:js…
39
3
Nathan Kerr's profile photoMonty Rasmussen's profile photo
5 comments
 
As detailed in this article (https://dart.academy/easy-dart-js-interopt/), you can avoid the need for such sharing using events.
Add a comment...

Adrián Avila

Discussion  - 
 
Do you ORM?
I must confess, I'm not a fan of ORMs, it is a nice idea that as many tools, works like a charm in simple cases but when things start getting complicated they become an obstacle and you end up puttin a SQL query in it anyway, other part that I don't like about ORMs is the bad performance you may get in some advanced cases, I've tried to used them, honestly, but I always return to creating my own persistence tier with plain SQL queries mapping the result to bussiness objects, after all, I have 15 years of SQL experience and I'm not afraid to use JOINS, UNIONS, TRANSACTIONS, creating the right indexes, etc, it is part of the job, "But that is so tedious" you may say, it may be, that's why I use tools, so instead of relying in ORMs, I create tools to do the boilerplace for me, like this one: https://imgur.com/6Aj5H5w, (Yes, I know it is not using a "Using" clausule to close the connection, it is an old version), with this tool, I specify the DB and after selecting the table it will generate code for creating the Class, the Persistence, REST Endpoints and even the Dart UI, it will generate it in two languages, C# and Ruby, and Java soon, I can even tune the query for better performance, I've using this tool for the past 7 years and it has worked very fine, so, how do you ORM?
Imgur: The most awesome images on the Internet.
5
Dan Weese's profile photoDenis Albuquerque's profile photo
9 comments
 
I recently have an experience with Java JOOQ for an app with PostgreSQL and was very pleased with the process of design the database -> automatically generate classes with JOOQ -> use JOOQ API to query with type safety. It would be awesome to have something like that in Dart ecosystem. 
Add a comment...
 
Dart Frontend + Xxx Backend? (Poll)

How does your Dart stack look like? I thought it could be interesting to see what technology combinations developers use. Please vote by simply adding a "+1" to the combination/combinations that you use in your Dart projects.

Note: I did a comments based poll since the built-in gplus poll don't allow more than 5 alternatives and you can't vote on more than one option.
17
Robert Åkerblom-Andersson's profile photoDan Parnham's profile photo
13 comments
 
We previously used Nancy in C# and I liked how routes were declared, so I attempted to replicate something similar in C++: https://github.com/parnham/libniven
Add a comment...

Created by

About this community

This is a place to talk informally with other Dart developers. We welcome all Dartisans, be they curious, experimenting, or experts. Use g.co/dartisans to find us! You can also find us on Slack: https://dartlang-slack.herokuapp.com/

Hannes Rammer

Contracts/Jobs/Gigs  - 
 
anyone looking for a dart developer based in berlin ? :) give me a shout
6
Add a comment...

Davy Mitchell

Announcements  - 
 
Dart 1.18 on Chocolatey :D
Chocolatey is a package manager for Windows similar to Linux's apt-get, based on Microsoft's Nuget tool and Powershell scripting language. It works from the command-line and from a WPF GUI interface. Good news - Chocolatey h...
13
Add a comment...

Filip Hráček
moderator

Discussion  - 
 
StackOverflow enters the documentation space. It seems well-thought-out and, given this is SO, they might actually pull it off.

Let me know what you think and feel free to add or suggest topics:
http://stackoverflow.com/documentation/dart/topics

(Kudos to those who've already done so!)
Q&A for professional and enthusiast programmers
21
2
Add a comment...

Hannes Rammer

Discussion  - 
 
Heya, I wanted to know if there is any documentation about Chrome extentions written in dart, and why is there no "generate sample content" option for chrome extensions.

I could not find any information about writing extensions with dart in the chrome docs, nor did I find any mention about chrome extensions on the dart websites ..

all I could find was
http://stackoverflow.com/questions/22154882/using-dart-for-chrome-extensions

and an example extension written in dart..
https://github.com/jifalops/PassGen

would be awesome to get some clarification :)
5
Kevin Segaud (Kleak)'s profile photoLunix Watt's profile photo
2 comments
 
The best way is to find the Chrome pub package in Dart, look at package's documentation, and have the JS documentation from Chrome not far. Semantics are often the same than in JavaScript version, with Dart-like structure. As well, documentation is auto-generated so that's why you need the JavaScript docs not far.

Finally, it's impossible to test Dart apps with Dart background pages directly in Dartium. Chrome supports only JavaScript for the event page logic.
Add a comment...

Davy Mitchell

Discussion  - 
 
Can anyone explain the thinking behind multiple cascades on single line with the auto-formatter? Is it for 2 or 3 calls to different methods?

I can possibly see cases where it would make sense but here it is just ugly when lots of similar calls.

Or maybe just needs refactored anyway :D
1
Günter Zöchbauer's profile photo
 
You can check the issues in the dart_style github repo. I'm sure there were a few discussions about that.
Add a comment...

Adrián Avila

Discussion  - 
 
Talking about the master - detail pattern.
One of the most know patterns is the Master-Detail pattern in classes (Not UI), it is one of the most simple ones, a master class has a reference to its details for example, a list of details, something like this:
Class Employee{
    int Id;
   String Name;
    List<EmployeeTask> tasks;
}
In that example, the Employee class has a detail of EmployeeTask, a list,  now, this is a very common and basic pattern,  if you need more details, you just add it to the class:
Class Employee{
    int Id;
   List<EmployeeTask> tasks;
   List<EmployeeSupervisors> supervisors;
}
In the case one employee has more than one supervisor.
One variance of this pattern I've using is, instead of putting the reference in the master, I put it in the detail like this:
Class EmployeeTask{
   int Id,
   Int IdEmployee,
   Task task
}
Class EmployeSupervisor Task{
   int Id,
   Int IdEmployee,
   Supervisor supervisor
}
And the master is defined like this:
Class Employee{
    int Id;
   String Name;
}
The advantage I've seen is this, is that lazy loading becomes easier, and the class may grow in details and remain the same, no need to update it, because it won have any reference, the way to obtain the details in a service would be.
List<EmployeeTask> pTasks = services.getEmployeeTasks(Employee.Id);
List<EmployeeSupervisors> pSupervisors = services.getEmployeeSupervisors(Employee.Id);
This pattern, witch I don't even know its name, make thing easier for me.
"But the master doesn't have a reference to iits details, ain't that problematic?" Not really, I haven't experimented one, yet.
1
Add a comment...

Filip Hráček
moderator

Discussion  - 
43
2
Mike Mitterer's profile photoBenjamin Jesuiter's profile photo
3 comments
 
I looooooove this sooooo much!!!! <3 <3
Add a comment...

Filip Hráček
moderator

Discussion  - 
 
Here's an elegant way to make lazy-initialized fields in Dart.

It uses the null-aware operator ??=. It assigns the value of _computeFoo() to _foo if _foo is null. The operator then returns the value to the getter.

When you know a field isn't needed every time and computing it is expensive, consider using this.

(Kudos to Stephen Adams for sharing this snippet on a mailing list earlier this month.)
21
2
Frederik Mutzel's profile photoAnders Holmgren's profile photo
4 comments
 
I do this a fair bit. I'd love some syntactic sugar for it like

int foo => _computeFoo();

int lazy foo => _computeFoo();

I raised a ticket for that years ago.

But at least it is much less verbose than it used to be.

Add a comment...

Nane Kratzke

Discussion  - 
 
RESTful API programming with #Dartlang. Some slides from my #webtechnology course (in german language).

http://de.slideshare.net/i21aneka/restful-apis-mit-dart
 ·  Translate
Kleine Einführung in die Entwicklung von RESTful APIs mit Dart. Auskopplung eines Foliensatzes aus der Lehrveranstaltung Webtechnologien des Studiengangs Infor…
17
Add a comment...

John Davis

Discussion  - 
 
installing chocolatey on windows10 is driving me nuts! trying to get chocolatey installed so I can install dart-sdk, since this is the officially sanctioned update mechanism. powershell scripts are boinking.
3
George Kormaris's profile photoDennis Kaselow's profile photo
4 comments
 
And one more tool for installation and updates of dart: https://github.com/mahonnaise/dart-up
Add a comment...