Zobrazují se příspěvky se štítkemdartlang. Zobrazit všechny příspěvky
Zobrazují se příspěvky se štítkemdartlang. Zobrazit všechny příspěvky

čtvrtek 26. ledna 2017

What I've baked the last year

I love helping developers, speaking at conferences, doing workshops, code labs and such kind of stuff. But before any event, I need to prepare myself very carefully and this takes me days and days of my time. In the past years I created a couple of (totally) different demos and workshops which sit on my Github without anybody knowing.

So I decided to share the latest ones I "baked" in this blog post, because maybe you find here something interesting for you :-)

After my Gingerbread hackathon: 9 Christmas trees 😂 


Uh, baking? I even managed to have the gingerbread and (czech) cookies baking hackathon in the end of the last year :-D

Dart server code lab

I am going to start with my Dart server code lab from 2015. This code lab was originally created for DevFest Ukraine 2015 (and used in a couple of other DevFests then) and aims Dart on server side using the RPC library. I have also written a blog post about it.

In this code lab you can learn how to do a server side API with Dart extremely fast: https://github.com/Janamou/dart-server-codelab.

Dart server-side Code Lab: https://github.com/Janamou/dart-server-codelab

Android testing workshop

Let's forget about the web (for a moment) and take a look at the Android side. The last DevFest Ukraine, I had a workshop on Android UI testing. During the workshop, I showed the options for UI tests on Android, why is important to write them and how tests help with the app development workflow.

The workshop has four parts - UI tests with UI Automator library, Espresso library, Test recorder tool and Monkey tool. You can explore it here: https://github.com/Janamou/android-testing-codelab.

Slides

You can also see my introduction to Andorid UI testing slides.

Progressive Web Apps talk

PWAs are a big thing. And I had a talk on last year's WebExpo about it. In the talk, I explained why Progressive Web Apps are great, why and when you need them and I also showed a demo.

The demo is online and it displays the list of "PWA" repositories from Github, caches the app shell and it also caches the repositories in case the connection is lost. The service workers are used for all these cool features in the application. The code is available on my Github: https://github.com/Janamou/pwa-demo.

Slides

You can also see my Progressive Web Apps slides.

How to build a Dart and Firebase app talk

This talk is from the last Dart summit and I have already wrote a blog post about it. In the talk, I explained how you can use Dart together with Firebase using the library.

The demo is also online and it is a simple notes board completely written in Dart (it uses the pure dart:html to make it simple/no fancy architecture). You can explore the auth, database and storage options provided by Firebase. The code is also on my Github: https://github.com/Janamou/firebase-demo.

Slides

You can also see my Dart and Firebase talk slides.


Happy coding and successful year 2017! :-D

neděle 18. prosince 2016

Dart Firebase3 lib is now Firebase

Just a quick update on Firebase Dart library.



My library Firebase3 has been deprecated and moved to the official Firebase repo (yay!) and is going to be developed there.

The update in your project is really easy, so please do it:

pubspec.yaml

Update your project's pubspec.yaml file. Change the firebase3 dependency to firebase:

dependencies:
  firebase: '^3.0.0'

Pub get

Do the pub get to get the latest dependencies.


Imports

Update imports in your project to use the firebase library:


import 'package:firebase/firebase.dart';


And you are done!

The Dart summit Firebase project has been already updated for the latest firebase lib.

Happy coding!  :-)

čtvrtek 3. listopadu 2016

Dart Developer Summit 2016

I was happy that I could attend this year's Dart Dev Summit because the last Dart Dev Summit was awesome.

The Dart Developer Summit 2016 took place in Munich's Google office this year, for two days at the end of October. And it was really worth to visit.



New Dart earrings

Couple of days before a summit, I realized that my current Dart earrings are a bit of outdated. We had so much fun together but the update was inevitable. And I knew I wanted to have them 3D printed.

In Saturday afternoon, I decided "now or never" and opened the 3D modeling software after, ehm, 5 years and started to remember how it worked. I forgot almost everything. Fortunately I somehow managed to have the model finished (after a lots of complaints :-D) and we could go to print!

We had to do a couple of iterations but at the end I had the earrings printed and put together. Let's call them Dart earrings 2 RC1 for now.

Dart earrings: the old vs. the new version

The earrings need some iterations still. And I am planning to release the 3D model when they will be perfect ;-)

Dart Code Lab

The evening before the summit, I helped with the organization of the Dart Code Lab again. Attendees could try two new Dart code labs - the first one on AngularDart components and the second one on the developer workflow.



We had also a lots of awesome demos from attendees showing us the projects they built with Dart. I enjoyed the evening with people from the community very much.

Dart Developer Summit

The Dart summit was two days event. The first day started with the keynote - Dart in 2017 and beyond where we could hear a lots of interesting numbers (did you know that there is more than $70B per year in Google applications written in Dart?) and about the actual Dart's state and focus. You can read more about this in the Dart news blog post.

Dart Dev Summit 2017 - on a boat? :-D

The summit then continued with a lots of interesting talks on various topics like Angular 2 Dart and it's components, the set of material design widgets written in AngularDart for developers.

We also heard about Dart's type system and a strong mode, the Dart Dev Compiler (yay!), and about the Dart to JavaScript interoperability and more. The JS interop talk is a definitely "must see" if you consider writing a wrapper around some existing JS library.

The conferences are not only about talks. We had a lot of space to meet and talk with Dart engineers and developers from the whole world.

I must also say that I loved the setup and decorations in the room.

Darts everywhere...

The second day started with the Flutter keynote. Flutter is a project which helps you to build both iOS and Android applications with Dart.

Flutter Flutter Flutter

Over the year, they moved the project (it was named Sky before) so much forward and with the hot reload feature, the development is even faster and more delightful to developer.

Flutter's hot reload: must see

I was very impressed and I am moving my personal todo "try Flutter" more to the top of my todo list. :-D

During the day we could see more talks on for example Google's build tool Bazel, server-side framework Aqueduct or Dart package for React.

The day ended with a panel discussion where we could ask questions and the Dart team answered.

All the videos from talks are online in the Dart Dev Summit 2016 playlist.

My Firebase talk

I was excited to have a talk on How to build a Dart and Firebase app in 30 mins. During the talk I showed what is a Firebase and how to use this service with Dart using the wrapper library Firebase3, I implemented. The library is available on pub and Github.

I am planning to write some article on how to use Dart + Firebase and how to write a JS interop wrapper soon.

For now you can take a look at the talk on Youtube, explore the slides, or the source code for the demo app I showed.

The demo is available online, the source code is on Github.

The demo is publicly available and is written in Dart using the Firebase library, then compiled and deployed to Firebase hosting.

The end

It's always so sad when such great event ends. The Dart Developer Summit was a really great event, I met a lots of Dart developers and saw really nice talks on topics which interest me. I filled my personal todo list with a lots of "must try" or "must explore" things.

I am really looking forward to the next year's summit and see ya on a boat! :-D

čtvrtek 7. ledna 2016

Dart RPC: Create RESTful API in a couple of minutes

I am on the front-end mostly because I like to work with UI. But let's move on and try something new, a little bit of server-side...


In this blog post I show you how to create your RESTful server-side API in Dart really fast! :-)

How to start

There is a really nice library on pub called RPC. It is a light-weight package for creating RESTful server-side Dart APIs. And this library is everything we need.

Let's start with adding dependency into pubspec.yaml in our project:

dependencies:
  rpc: "^0.5.5"

And then call pub get to get the package into our project.
Now you can import it.

import 'package:rpc/rpc.dart';

Create API class

We need to create API class which wraps our API. It is a Dart class with special @ApiClass annotation from the RPC library. The annotation has one mandatory parameter - version where we provide a version for our API. For example v1. You can also optionally provide other parameters like name to be able to rename the API.

@ApiClass(version: 'v1')
class MyApi {
  // here will be contents of the class.
}

API methods

We want to be able to provide API methods like GET, POST, DELETE, etc. We put them in our already prepared API class with special annotation.

Methods can be put directly into our API class or API resources can be used.

Methods in API class

Here we create the GET all animals and POST animal method. Every API method has to have the @ApiMethod annotation with mandatory path parameter where we specify the path which is used for calling of our method. We can also specify the method parameter where we provide type of the method which will be used. If the method parameter is omitted, the GET is used.

@ApiClass(version: 'v1')
class MyApi {
  List _animals = [];

  @ApiMethod(path: 'animals')
  List<Animal> getAnimals() => _animals;

  @ApiMethod(path: 'animals', method: 'POST')
  Animal postAnimal(Animal animal) {
    _animals.add(animal);
    return animal;
  }
}

We are using List for saving of our animals in this example. And we provide two methods: getAnimals() which returns a list of all animals and postAnimal() which saves a new animal into our list. Easy. Of course we could extend our example API with other methods.

To have it working we also need to have our Animal class:

class Animal {
  int id;
  String name;
  int numberOfLegs;
}

API resources

Usually we want to divide our API into resources which wrap the particular API methods. We want to for example have one API resource for an Animal and one API resource for a Person. We can do this with the RPC library easily.

Create the resource class and move all the resource methods in it:

class AnimalResource {
  List _animals = [];

  @ApiMethod(path: 'animals')
  List<Animal> getAnimals() => _animals;

  @ApiMethod(path: 'animals', method: 'POST')
  Animal postAnimal(Animal animal) {
    _animals.add(animal);
    return animal;
  }
}

And then create the AnimalResource instance into our API class with @ApiResource annotation:

@ApiClass(version: 'v1')
class MyApi {
  @ApiResource()
  AnimalResource resource = new AnimalResource();
}

Test the API

To be able to use and test our API, we need to create the server script in bin/ folder. We need to create the ApiServer there, add it our API and create a new HttpServer which starts listening on localhost:8080.

library my_server;

import 'dart:io';
import 'package:logging/logging.dart';
import 'package:rpc/rpc.dart';
import '../lib/server/api.dart';

final ApiServer apiServer = new ApiServer(prettyPrint: true);

main() async {
  Logger.root..level = Level.INFO..onRecord.listen(print);

  apiServer.addApi(new MyApi());
  HttpServer server = await HttpServer.bind(InternetAddress.ANY_IP_V4, 8080);
  server.listen(apiServer.httpRequestHandler);
  print('Server listening on http://${server.address.host}: ${server.port}');
}

Then run the Dart script in bin/ which starts the server and explore the API methods. Our API is available on localhost:8080/myApi/v1. If we want to get a list of all animals, we call GET on localhost:8080/myApi/v1/animals. Or we can try the POST for the new animal on the same address localhost:8080/myApi/v1/animals.

Trying a POST method is more difficult because we need to either install a tool like curl or we can use some extension to Chrome (like Advanced REST client or Postman).

And that's all! Now you have a really simple Dart API created in a couple of minutes.

Where can I find more?

This library can do even more. You can find all information about this library on the official RPC's site on pub or on Github.

My server Code Lab

I was happy to be and talk at couple of DevFests last year, where I had also a Dart code lab. My code lab was about server-side and as you could guess, I used the RPC library :-) You can take a look at and try the code lab on my Github.

Happy coding!

čtvrtek 5. listopadu 2015

3 simple steps for Sass in your Dart project

I really like Sass and I can't imagine writing css without it. With Sass you can use variables, mixins, nest your css and do lots of things in css.



So why not use Sass in your Dart project? It's really easy. 

You need to have Sass installed and available on the path. For how to check the official website.

And now add Sass to your Dart project:

1) Install Sass package

Find Sass package on pub. Here it is: https://pub.dartlang.org/packages/sass.

2) Update pubspec.yaml

Add Sass dependency in your project's pubspec.yaml. Don't forget to add transformers too:

name: super_cute_app
description: My super cute app!
dependencies:
  …
  sass: any
transformers:
- sass

And then run pub get.

3) Use it 

Now you can create and use .sass and .scss files in your project and these files will be automatically transformed to corresponding .css files.

This package has also some more options.

Bonus: Live reload

Do you know Live reload? No? I am using this tool with css/Sass in my projects.

It monitors changes in your file system. When you change the (css or Sass) file, the connected web browser is refreshed. So I don’t have to do manual browser refresh after every change in my stylesheets.


And that's all for today and I hope you now enjoy Sass in your Dart project! :-)

čtvrtek 29. října 2015

DevFest Ukraine 2015

This year I and my friend Jakub Škvára were invited as speakers to DevFest Ukraine 2015. I watched their event on social networks last year and when I got an invitation to speak there this year, I was really super happy and made a proposal for both Dart talk and a Code Lab.

DevFest Ukraine 2015 took place on October 23 - 24 in Lviv. Because there is no direct flight from Prague to Lviv, we had to transfer in Warsaw. Everything went fine and we successfully arrived to Lviv the evening before. Organizers prepared for us a special city tour around the city center and we heard a lot about Ukrainian history and saw a lot of Lviv's historical beauty.

Lviv's beauty according to Google Photos

Talks

The event started next morning with the keynote followed by talks in three parallel tracks: Android, Web & Cloud and community. And there were 40 sessions during the whole event!

DevFest Ukraine 2015 just started!


I and Jakub both had talks on Friday and code labs/workshops on Saturday. I had a talk with name Let's play Dart! where I talked about why I love Dart and why working with it makes me so much happy and productive developer. You can take a look at my slides on Slideshare:




Jakub had a talk about Polymer vs other libraries. During his talk he compared Polymer elements with components from React and Angular and showed us lots of examples.



You can also take a look at his slides on Slideshare:




During the day there was a lots of great talks about Android, Angular, Firebase and more.

You could also taste Marshmallows:



Or all Android versions:

All Android versions to eat ♥

More Androids!


The first day ended with a great afterparty!


Code Labs

The next day you could see also a lots of talks and Code Labs. But for me and Jakub it was mostly a Code Lab day.

We both had our Code Labs after the lunch. I started with mine about Your first server-side application in Dart in which you could create a simple RESTful API with all speakers and sessions from the conference using the Dart's powerful (and really easy to use) rpc library and Jakub had a Code Lab about creating a Polymer front-end application for this API.

Dart Code Lab!

You can find both our Code Labs on Github:


I am planning to update my Code Lab soon a little, probably with integration to App Engine and a client-side app.


Summary

I am really happy that I could be part of a great DevFest Ukraine 2015. The event was nicely organized, had a great atmosphere and organizers were always helpful and took care about us really nicely. We had also a lot of fun with other speakers and organizers and we could taste a local food and beer in nice restaurants.

I definitely recommend going to DevFest Ukraine next year!



Next month I am looking forward to DevFest Silicon Valley 2015 and next? ... ;-)

And the last photo from Ukraine's Lviv:



čtvrtek 24. září 2015

Dartdoc: Generate a nice documentation for your Dart package

We developers love creating code. But this is not only about writing actual code but, for example, also about writing documentation for your code. Now you can say that code should be self-documenting. Which definitely should be but this is not everything.

Writing documentation for your code gives you a lot of benefits and it should be part of your daily coding job.

Documentation and Dart

There is a really nice article about writing documentation in your Dart projects and this my blog post will show you how to benefit from your documented Dart code.

Dart has a tool for generating nice HTML documentation for your Dart package. The latest Dart version - Dart 1.12 came with a new version of this tool, now called dartdoc, which replaces the old docgen tool.

Dartdoc generates a nice HTML documentation for your package easily and very fast. And it also looks really nice.

How to run dartdoc?

Simply run dartdoc tool from the root directory of your package.

dartdoc

Just that simple. No extra parameters needed.

And now watch how it generates a nice documentation into a doc folder in your project. Then just simply open the doc/api/index.html file in your web browser and tadaaa, you can explore your documentation :-) Nicely generated documentation available really fast.

For a usage information about the command add -h or --help option:

dartdoc --help
Generate HTML documentation for Dart libraries.

Usage: dartdoc [OPTIONS]

-h, --help            Show command help.
    --version         Display the version for dartdoc.
    --dart-sdk        Location of the Dart SDK. Use if SDK isn't automatically located.
    --sdk-docs        Generate ONLY the docs for the Dart SDK.
    --sdk-readme      Path to the SDK description file. Use if generating Dart SDK docs.
    --input           Path to source directory
                      (defaults to "/Users/janamou/Projects/my_super_project")

    --output          Path to output directory.
                      (defaults to "doc/api")

    --header          path to file containing HTML text, inserted into the header of every page.
    --footer          path to file containing HTML text, inserted into the footer of every page.
    --package-root    The path to the package root.
    --url-mapping     --url-mapping=libraryUri,/path/to/library.dart directs dartdoc to use "library.dart" as the source for an import of "libraryUri"
    --exclude         Comma-separated list of library names to ignore.
    --include         Comma-separated list of library names to generate docs for.
    --hosted-url      URL where the docs will be hosted (used to generate the sitemap).

Dartdoc tool is also available on Github so if you find any issue with it, you can simply report it. Or you can contribute to the project.

Dartdoc in action

If you want to see new dartdoc already in action, take a look at the official Dart SDK API documentation. Browse through it. Nice isn't it?



Have you already tried dartdoc? Is generating of documentation part of your workflow?

Se ya soon again!

čtvrtek 14. května 2015

Dart Developer Summit: Awesome two days spent with Dartisans

The first Dart Developer Summit took place in San Francisco's Google office at the end of April 2015 and it was two days full of Dart awesomeness! In this blog post   I summarize my feelings from the first Dart oriented summit.




Dart Code Lab

The evening before summit I led the 4 hour Dart Code Lab. Attendees had the opportunity to play with Dart through client-side and/or new server-side code lab, talk and get direct help from Dart engineers and see demos of some Dart projects.

I am really happy that I could spend nice evening with lots of Dartisans, talk with them and share my enthusiasm... about Dart :-D.

Photos by Faisal Abid


If you haven't seen the new server-side code lab yet, I definitely recommend to take a look! The code lab will help you to dive into Dart on server-side using the new RPC package really quickly.


Dart Developer Summit

Two days long summit with all about Dart full of talks, networking and more.

Dart cake!


The summit started with a Keynote: Dart Today and Tomorrow, where Dart co-founders Lars Bak and Kasper Lund highlighted motivation behind Dart, talked about topics such as Dart on Mobile and showed us the nearest Dart SDK roadmap.

Dart SDK roadmap


On what we can look forward to? Fletch, Dart Mobile Services, Dev Compiler, Dart SDK 2.0. Yep, and WebStorm becomes preferred IDE for Dart. Time to move out from the Dart editor.

And then the summit continued with talks from both Dart software engineers and other developers using Dart every day.

Observatory tool


We heard how to use Async in Dart (love async/await and definitely recommend using it, I wrote about it in my previous blog post), Observatory (I need to explore this powerful tool more deeply!), Reflection, Dart2js, external developers talking about switching to Dart and more.

Dart for the Web - SYODLAJS = Ship your own Dart Library as JavaScript


And the summit was not only about talks! It was also about networking and meeting other developers.

There were tons of Dart software engineers prepared to talk with you and help. Part of the schedule were also special breakouts sessions in which we were divided into smaller groups interested in some topic we proposed and voted for before (such as testing, Observatory, server-side,...) and then we discussed that particular topic.

The first day ended with lightning talks about not only Dart related topics (but the lightning talks are always fun).

Dart for Mobile


Next day we heard talks such as how the Google Ads team is using Dart (and makes their developers and users happy), moving from Node.js to Dart, and two Dart on Mobile talks: Dart for Mobile and Sky project. Pure awesomeness!

Sky experiment: No Java, just Dart...


And finally there was also a panel discussion as a part of a schedule. You asked questions, engineers answered. So interesting and fun!

Fun on panel discussion


You can find all the videos from talks at Dart summit online in this play list.

The Dart Developer Summit was really great event where you could learn a lot new about Dart, share same interests with developers from different parts of the world, meet Dart software engineers, talk with them and get help. I really hope that this event will also take place next year!

úterý 31. března 2015

Tour of last week's news in Dartiverse


Last week was really rich in official news from Dart. In this blog post, I will summarize the things that happened last week in Dartiverse and yes, lots of things happened! Are you prepared?




REST API with Dart

Dart team released RPC package for creating RESTful server-side Dart APIs. Yay! This package will help you with data serialization and routing of requests.

Projects which are using RPC package at the moment are DartPad and TodoMVC, both are on Github. You can read how to use this package and download it either on pub or on Github.

Dart for the Entire Web

These were really important news for the community. Dart team decided not to integrate the Dart VM into Chrome and they are focusing on better compilation into the JavaScript. This makes sense to me because Chrome is not the only one browser on the entire world so the Dart application has to be always compiled into the JavaScript.

And what do we want? Why we are using Dart? We want to be more productive, have the possibility to use great tools and libraries. And this is exactly what Dart brings to us, we are not losing anything from that. So for us, developers, there is no change. But imagine even better tools, server side and Dart on mobile. And these are exactly the things they are working on now.

I am really looking forward to the Dart summit because lots of these topics will be covered in Dart Summit speeches.

And finally. Google Ads is using Dart. With million lines of Dart code - this is great!

async, async*, await, yield...

These mysterious words deserve more attendance. They are really powerful because they make you more productive.

Have you read this article about using async and await? No? Well, you really should. Take a look at this small example.

Instead of this:

HttpRequest.getString("animals.json")
    .then(feedAnimals);

you can now write this:

feedAnimals(await HttpRequest.getString("animals.json"));

But it is not now only about async and await. We have more power in our hands! async*, sync*, ... Take a look at the second article about new Dart language asynchrony support.

Dart 1.9

Dart 1.9 is probably one of the biggest releases after 1.0 and it was really worth waiting for. With 1.9 you can try the new Dart language asynchrony support and full support of enums.

I can't also forget the awesome formatter, which is now integrated into dartfmt tool and that's not all. You can read more news about 1.9 in the release notes.

Soooo. Have you already tried async and await in your code?

Happy coding!

středa 18. března 2015

I would like a sortable list for my Dart application, please.

I remember my days with jQuery. When I wanted to implement for example sortable list, I searched on Google for some plugin, included jQuery and the plugin, initialized it and it worked. And now I am working on some Dart application where I would love to have sortable list, so I have to implem...

OMG, wait! No, I don't have to!

My goal is to have a list (usually ul - li elements) with a possibility to reorder list items with drag and drop. In this blog post I will take a look at some libraries which interested me on pub.

The libraries are assortment and dnd.

assortment

assortment is a simple library, which can create a sortable list. Library is really easy to use, you just add import for the library:

import 'package:assortment/assortment.dart';

Create an ul - li list in HTML:

<ul id="sortable-list">
  <li>Red</li>
  <li>Green</li>
  <li>Blue</li>
</ul>

Then you need to create new Assortment object with retrieved ul list as a parameter and then it is needed to add it retrieved children - li elements.

Assortment assortment = new Assortment(querySelector('#sortable-list'));
assortment.addElements(querySelectorAll('#sortable-list li'));

Usually you also want to do something after the change in the list (for example update model) so you can listen for prepared events from assortment:
  • onDragStart
  • onDragEnter
  • onDragEnd

AssortmentEvent allows you to get the event and elements which participated in reorder.

For example:
assortment.onDragEnd.listen((AssortmentEvent event) {
  print("onDragEnd fired!");
});

That's it! You have a simple drag and drop sortable list. The library works with any elements, so you can normally use div elements instead of ul - li list.

And finally, you can find this library on pub and Github.


dnd: Dart Drag and Drop

Library Dart Drag and Drop allows you to work with drag and drop in whatever way you can imagine. You can create basic draggable object, free dragging object, dragging object using horizontal or vertical axis and more! It also supports creating of sortable lists which was the thing, I wanted.

http://code.makery.ch/library/dart-drag-and-drop/

For more demos of this library take a look at the official website.

How to create sortable list? Import the library:

import 'package:dnd/dnd.dart';

Then create Draggable and Dropzone object with AvatarHandler (this ensures visual feedback during dragging) which are using the retrieved li elements.

Draggable draggable = new Draggable(querySelectorAll('#sortable-list li'),
      avatarHandler: new AvatarHandler.clone());
Dropzone dropzone = new Dropzone(querySelectorAll('#sortable-list li'));

And finally define onDrop event on dropzone:

dropzone.onDrop.listen((DropzoneEvent event) {
    swapElements(event.draggableElement, event.dropzoneElement);
});

swapElements() is your implementation of changing position of elements in the list. For example take a look at the official example but your implementation can be different.

It is also possible to listen to different types of events for both objects.

Draggable object:
  • onDrag
  • onDragStart
  • onDragEnd

Dropzone object:
  • onDrop
  • onDragEnter
  • onDragOver
  • onDragLeave

And that's also it. I really recommend to go through all the examples because this library can do lots of things. And a big plus is, that the list also works on mobile. You can use it also with div elements and the library is available on pub and Github.

That's all for today. I really like both of these libraries and I think that they can help a lot. Have you tried any of these libraries?

Happy Dart coding! :-)

čtvrtek 19. února 2015

Dart Designer: Diagrams for your Dart application

Recently I wanted to create diagrams for some Dart application and was curious if there exists some tool dedicated directly to Dart. And after some searching I found Dart Designer which is available on Github.


http://dartdesigner.github.io/


Dart Designer

Dart Designer is the graphical tool based on Eclipse which helps you with creating diagrams like package diagram, class diagram and more. It comes with integrated Dart Editor so you can also develop in it.

To start working on diagrams you just need to create a new Dart Designer Project and then you can start working on diagrams. Dart Designer also knows Dart language features like Mixins.

This is how you create class diagram in Dart Designer

To explore how to use the designer, I recommend to take a look at the official video.

Dart Designer looks like a great tool for creating diagrams because it knows Dart. The only thing I am missing, is the possibility to create diagram from existing Dart code and vice versa.

Happy Dart diagramming! :-)

středa 4. února 2015

Happy to be Dart Google Developer Expert!

It's a big pleasure for me to say, that I recently became Google Developer Expert (GDE) for Dart language.

Who are the Google Experts?

Shortly said:
Google Experts are a global network of experienced product strategists, designers, developers and marketing professionals actively supporting developers, startups and companies changing the world through web and mobile applications.
You can read more about them on site: https://developers.google.com/experts/about

What does this mean to me?

Besides of developing in Dart I really love meeting and helping to other developers so I will continue helping the community.

I have some experience with co-organizing Dart related events like code labs (to learn Dart), hackathons (to code and have fun with Dart) and I love talking about Dart. So if you plan to do some Dart related event and want to help or you are looking for speaker, don't hesitate to contact me! :-)

úterý 20. ledna 2015

dart_style: How to make your Dart code even better

Recently I noticed a package dart_style which helps you have your code according to the Dart Style Guide.

It is a formatter/linter for Dart code which you can run on desired files from the command line. It then outputs formatted code directly to the command line or you can let overwrite existing files with formatted code.

Update: dart_style package is a new Dart formatter dartfmt!

How to install?

We need to activate globally the package via the command in command line:

pub global activate dart_style

I personally use it directly from Github to have always last (dev) version via the command: 

pub global activate --source git https://github.com/dart-lang/dart_style.git

How to use?

And now the magic begins with the command dartfmt. For example:


dartfmt index.dart

This outputs formatted index.dart in the console. But usually I want to directly format all my files in the folder and overwrite my existing files with formatted code. The parameter -w does this trick for me:

dartfmt -w lib

This command goes through all the .dart files in the lib folder and tries to format them. In my case the output may look like this:


Formatting directory lib:
Unchanged controller.dart
Unchanged model\user.dart
...
Formatted view\app_view.dart
Formatted view\menu_view.dart
...

And that's it! Your code should be now nicely formatted. And it is possible to use the formatter not only via the command line but also programmatically.

Dart style formatter is now one of my favourite tools used during Dart development and it helps me to have my code even better.

What do you think about Dart style formatter? Have you tried it?

středa 12. listopadu 2014

How we did Dart and Polymer.dart Code Labs

Last Saturday me and Jakub Škvára participated in DevFest Kraków as Code Labers for Dart and Polymer.dart. I am really happy that we had such opportunity to visit this event, meet other developers and finally visit Poland.

We did this Code Labs after our Code Labs in Prague and we wanted to do them differently. We wanted to show some easy application in Dart and then rewrite it directly into Polymer.dart to show how easy and great it is. Each Code Lab was 1.5h long.

Code Lab Applications

So we did two simple Note-taking applications, one in Dart using dart:html library and Twitter Bootstrap for styles and the second one in Polymer.dart with Paper elements.

Both Code Labs are available on Github divided into some steps.

Dart Application


Dart application

Polymer.dart Application

Sources and Code Lab text: https://github.com/jskvara/dart-polymer-code-lab-krakow

Polymer.dart application

Code Lab best practices for future Code Labers :-)

Do you also plan to do some Code Lab? After our three Code Labs I can share some best practices which worked for us:

  1. Do a short presentation before the actual Code Lab. Answer on these questions: What is it? Why/when to use it? How to use it?
  2. Try to code some basics with people before the actual Code Lab: Let's code our first "Hello world!". Which value is in int count;? How to write method/class/constructor/inheritance etc.?
  3. Ask people if they have any problems or questions after each bigger step and help them solve it. Communicate with them.
  4. Have fun! :-)

And finally, I am sharing some photo from beautiful night Kraków.


Beautiful, isn't It?

pondělí 27. října 2014

Stagehand: Tool you want to use for your next Dart project

Yesterday I found a great tool with name Stagehand. I would say that this tool makes happy Dart developer even more happier. Stagehand helps you create a new Dart project easily with all the important things prepared.

Yes, creating a new project with Dart Editor is nice but with Stagehand it is awesome. Creating a new project for me without Stagehand always involved searching wherever for the .gitignore file (if you do not know .gitignore.io) and then searching for some libraries etc.

With Stagehand you have everything important prepared.

How to install?

As a first thing you should update to the latest version of Dart SDK.

And then run in the command line:

pub global activate stagehand

I had to also add some folder to the PATH on Windows. Then you are done. You can use it :-)

How to use?

Using of Stagehand is really easy. When you are in the desired folder where you want to generate the project, just run:

stagehand <apptype>

where the apptype is:
  • consoleapp
  • package
  • polymerapp
  • shelfapp
  • webapp

I will create a new web application project into my folder with command:

stagehand webapp

And then open the project in Dart Editor, run it and see, what Stagehand did.

Stagehand web template
Nice Dart web application

Inspecting project files is event better. You will see that you have prepared responsive website with Sass, CSS minification and even routing!

That is a good start for a new Dart web project, isn't it?

With Stagehand you can also start your new Polymer project, console app, shelf app or package. One option I am missing is Chrome packaged app, hope it will be added in the future.

Do you plan to try Stagehand for your next project? For me it is definitely YES.