Evolution of Dart: Dart which is a demanded skill in the industry today and developed by Google has upgraded itself through many layers since it came into the market. Evolution of Dart has been an interesting journey of its updations in functionalities and convenience to developers. At first Dart focused on enhancing website development, and later expanded to other areas as well. Soon after Flutter came, it’s demand surged significantly and here’s how it went. This blog will cover the evolution of Dart and it’s achievements, improvements and milestones till now.
Dart 1.0
The1.0 interpretation release of Dart came at a time when Dart was meant to be a JavaScript relief. It was also strategized to include a Dart VM directly in Chrome to make it compatible to run Dart without changing it. Still, these plans changed latterly, and Dart became by compilation JavaScript rather.
Version1.0 was quiet different from the Dart we know now. It featured a type system that wasn’t sound. Types were simply reflections in the language allowing particles like these to run successfully:
void main(){
int a = 3; // a is declared as an integer
a = 'This is a string'; // a is assigned an integer
}
Dart 2.0
Dart interpretation 2.0 was one of the most substantial Dart releases ever. It made an elaborate system and moved the language towards Flutter rather than the Internet. The release made Dart more relatable to Java/ Kotlin/ Swift developers, which made the core of Flutter’s developers base. Still, utmost developers saw null safety as a significant missing point lately switching to null-safe languages similar as Kotlin.
This was a valid code in dart if there was not a null safety:
Shape shape;
shape.calculateArea(); //No compile-time errors
Output: Runtime error since shape is null
Dart 2.12
Dart 2.12 eventually brought sound null- safety to Dart alongside a number of other changes, similar as a stable Foreign Function Interface( FFI), which allows effective communication with native platforms. After sounding null safety, getting runtime errors for developers was much more grueling . Still, this interpretation also allowed running the app without null- safety or incompletely with null- safety.
This is what null-safe program looks like in the former illustration:
Shape? shape; //Shape now has to be declared as a nullable type
shape/.calculateArea(); //Method will only be called if Shape object is not null
Dart 3.0
Dart 3.0 brings along several features asked for by Flutter developers worldwide, similar as patterns, records, and capability controls for classes. It also makes it mandatory to use null-safe systems. Systems can not run with a partial null- safety post this interpretation. This results in performance advancements since one can exclude several runtime checks.
This is a sample record and pattern in simplified Dart 3.0 program:
void main(){
double length = 0;
double width = 0;
Shape shape = Shape();
(length, width) = shape.calculateLengthAndWidth();
}
//Inside the Shape class
(double, double) calculateLengthAndWidth(){
return(shapeLength, shapeWidth);
}
For more detailed information do check Documentation.