Dart is awesome

I recently started working with Flutter by creating my first mobile application for the company’s hackathon.

Prior, I took the course in O’Reilly, which amazingly introduced me to the world of “one code – multiple platforms”.

Flutter is the whole story and requires a separate post.

In the few posts, I’d like to share my expression from the Dart language – which is the language of programming for Flutter apps.

What is Dart

Dart is a programming language designed for client development,[8][9] such as for the web and mobile apps. It is developed by Google and can also be used to build server and desktop applications.
It is an object-orientedclass-basedgarbage-collected language with C-style syntax.[10] It can compile to either native code or JavaScript, and supports interfacesmixinsabstract classesreified generics and type inference.[11]

Wikipedia

The Flutter multi-platform applications are programmed with Dart.

Dart code can be easily converted to JavaScript using dart2js tool.

There is a huge similarity between Dart syntax and Java and JavaScript languages as well as implemented features from other languages like Python.

While JavaScript implements the OOP principles prototypical, the syntax of Dart, is very close to Java with some additional possibilities (like positional and named parameters constructor, default values).

The ease of working with JSON structures and working with them as a Dart object.

Mixins, the widely used feature in Python, can be easily implemented in Dart as, one of the solutions, for multiple inheritances.

Concurrency is another important feature for developing powerful applications. Here, the syntax is also very similar.

String interpolation is the easy and clear way of constructing dynamic contents.

Example

main() {
var h = “Hello”;
final w = “Hello”;
print(‘$h $w’);

print(r’no interpolation for $h $w’);

var hello = ‘Adjusting’ ‘String’;
print(hello);

print(‘${hello.toUpperCase()}’);
print(‘The answer is ${5 + 10}’);


var multiline = “””
This is
miltiline “””;
print(multiline);
}

Dart basic code “Hello World”

Reference

Dart Language Tour by dart.com

Dart in action, by Chris Buckett