toCustomText method

String toCustomText(
  1. String trueText,
  2. String falseText
)

Returns trueText if true, falseText if false.

Example:

bool flag = false;
print(flag.toCustomText("It is true", "It is false")); // Output: It is false

Implementation

String toCustomText(String trueText, String falseText) =>
    this ? trueText : falseText;