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?
~/ Divide, returning an integer result. and ~/= integer division and assignment.
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.
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.
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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With