Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ~ mean in Dart?

Tags:

Seen tilde in a few code examples in Dart. I've seen it used in C++ as a destructor where it can be called to delete the instance of a object Has it the same function in Dart? Is there an equivalent symbol in Java?

like image 730
flutter Avatar asked Aug 30 '18 16:08

flutter


People also ask

What does ~/ mean in Dart?

~/ Divide, returning an integer result. and ~/= integer division and assignment.

What does <> Do in Dart?

It allows specializations of classes. List is a list that can contain any value (if no type parameter is passed dynamic is used by default). List<int> is a list that only allows integer values and null`. You can add such Type parameters to your custom classes as well.

What is ~/ operator in Dart?

operator ~/ method Null safetyTruncating division operator. Performs truncating division of this number by other . Truncating division is division where a fractional result is converted to an integer by rounding towards zero. If both operands are ints, then other must not be zero.

What does => mean in flutter?

From the documentation: For functions that contain just one expression, you can use a shorthand syntax. The => expr syntax is a shorthand for { return expr; } . The => notation is sometimes referred to as arrow syntax.


1 Answers

Dart doesn't support destructors

https://www.dartlang.org/guides/language/language-tour#operators

~ is currently only used for

~/ Divide, returning an integer result

and ~/= integer division and assignment.

There is not really an equivalent in Java.
In Java the result is an integer if the result is assigned to an integer variable (not sure though, not a Java dev)

like image 65
Günter Zöchbauer Avatar answered Sep 23 '22 02:09

Günter Zöchbauer