メインコンテンツへスキップ

All Posts

News bits

Dart 3

Google I/O 2023 で、Dart 3 の正式リリースが発表。

出展:Announcing Dart 3

Dart は Flutter でしか使う機会はなく matsuri 社では全く使っていませんが、個人的な認識として Flutter ほど Android、iOS それぞれに依存した機能にまで対応したクロスプラットフォームフレームワークは存在せず、利便性は現状一強であると思っているので、リリースを少し取り上げます。

#100% sound null safety

Dart は約 4 年をかけて、完全に Null safety になりました。これにより Null Pointer Exceptions などのランタイムエラーの回避や、コンパイル時に Null がないことを前提として最適化が可能になります。

Dart では 2 系から Null safety のモードを切り替えられるようにするなど段階的な移行を行なっており、既に人気な上位 1000 位までのパッケージの 99%は Null safaty に対応をしています。

#パターンマッチング

Rust などのパターンマッチと一緒です。次のように記述します。

dart
// seald修飾子によって、これは閉じた型族のルートになり網羅チェックが有効になる
sealed class Shape {}

class Square implements Shape {
  final double length;
  Square(this.length);
}

class Circle implements Shape {
  final double radius;
  Circle(this.radius);
}

// switchが式で利用できるようになった。
double calculateArea(Shape shape) => switch (shape) {
  Square(length: var l) => l * l,
  Circle(radius: var r) => math.pi * r * r
};

著者について

Hi there. I'm hrdtbs, a frontend expert and technical consultant. I started my career in the creative industry over 13 years ago, learning on the job as a 3DCG modeler and game engineer in the indie scene.

In 2015 I began working as a freelance web designer and engineer. I handled everything from design and development to operation and advertising, delivering comprehensive solutions for various clients.

In 2016 I joined Wemotion as CTO, where I built the engineering team from the ground up and led the development of core web and mobile applications for three years.

In 2019 I joined matsuri technologies as a Frontend Expert, and in 2020 I also began serving as a technical manager supporting streamers and content creators.

I'm so grateful to be working in this field, doing something that brings me so much joy. Thanks for stopping by.