looseEqualString method

String looseEqualString(
  1. ExpressionOld other, [
  2. Size sampleSize = const Size.square(100)
])

Implementation

String looseEqualString(ExpressionOld other, [Size sampleSize = const Size.square(100)]){
  double samplePercent = percentGetter(sampleSize);
  double otherSamplePercent = other.percentGetter(sampleSize);
  String percentEqual = samplePercent == otherSamplePercent ? '==' : '!=';
  (double, PxUnit)? sampleLiteral = literal?.call(sampleSize);
  (double, PxUnit)? otherSampleLiteral = other.literal?.call(sampleSize);
  String literalEqual = sampleLiteral == otherSampleLiteral ? '==' : '!=';
  String finalEqual = samplePercent == otherSamplePercent && sampleLiteral == otherSampleLiteral ? 'true' : 'false';
  return '''percent part:$samplePercent $percentEqual $otherSamplePercent
literal part:$sampleLiteral $literalEqual $otherSampleLiteral
result: $finalEqual
''';
}