Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define new operators in Dart?

I want to define a a custom operator in dart,like:

condition ?: func();
like image 332
frank Avatar asked Jan 21 '26 16:01

frank


1 Answers

It is not possible to define new operators in Dart. See Open issue - Support for defining a new operator https://github.com/dart-lang/language/issues/607

You can only override the behavior of existing operators like it is explained in Does dart support operator overloading

like image 60
Dalija Prasnikar Avatar answered Jan 26 '26 21:01

Dalija Prasnikar