INNER CODE UNIT · Dart

compare

Ephenodrom/Dart-Basic-Utils · lib/src/BooleanUtils.dart:66

  static int compare(final bool x, final bool y) {
    if (x == y) {
      return 0;
    }
    return x ? 1 : -1;
  }

  /// Converts an int to a boolean using the convention that zero
  /// is false, everything else is true.
  ///
  ///   BooleanUtils.toBoolean(0) = false
  ///   BooleanUtils.toBoolean(1) = true
  ///   BooleanUtils.toBoolean(2) = true
  static bool toBoolean(final int value) {
    return value != 0;
  }

  /// Converts a String to a Boolean.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…