Dart isNegativeで数値がマイナスであるかを判定する
環境
OS windows11 Pro 64bit
Dart 2.18.4
書式
数値.isNegative
「 isNegative 」を使用してマイナスであるかを判定します。
使用例
void main() {
print((23).isNegative);
print((-34).isNegative);
print((0).isNegative);
print((-0).isNegative);
}
実行結果
false
true
false
true