• A really simple Dart app for the web: Regular Polygons

    As I mentioned in my introductory post, I’m not just a Dart developer; I’m also a computer graphics enthusiast. I’ve been meaning to break out of the realm of purely academic Dart code and give you some examples of graphics code. As a first step towards that goal, today I wrote a tiny Dart app that runs in any web browser. I compiled it to JavaScript using dart2js. And here are the results!

    Read on →

  • Spruce up your Dart code with generators

    If you’re a programmer, regardless of your domain, you probably write a lot of code that deals with sequences of values. In most cases, a data structure like an array is the best tool for these jobs. You can simply write out every value your program will need to process as a constant before the program runs. Your program can then iterate through the data structure at runtime and pull out new values one at a time.

    Read on →

  • Dart's constructor syntax in action

    In my last post, I showcased Dart’s efficient constructor syntax for assigning parameters to instance variables. Today I’m giving you some short example code to work with so you can see just how quickly you can build out a new class in Dart.

    Read on →

  • How Dart cuts away boilerplate code

    When you think of the process of creating software, what image comes to mind? If you’ve never actually written a substantial program before, you’d be forgiven for assuming it to be a fairly linear series of steps. Perhaps it begins with an architect, who draws up specific plans for every aspect of the program. Then it might be up to a team of developers to convert those plans into code. The developers would probably need to communicate with one another to decide on which conventions to use, but as long as they stick to the architect’s plan, development should be pretty straightforward.

    Read on →

  • Dart's elegant optional arguments

    Almost all modern programming languages include the concept of optional arguments. The idea is pretty easy to understand. Every function has a list of zero or more arguments (also called parameters) that serve as the function’s input values. When you call a function, you supply values for these arguments. Many arguments are required, meaning that you must supply their values in order to call the function. Optional arguments, however, can be omitted. When you don’t specify a value for an optional argument, a default value is used.

    Read on →