toYesNo method

String toYesNo({
  1. String yes = 'Yes',
  2. String no = 'No',
})

Returns 'Yes' when true and 'No' when false.

Example:

true.toYesNo(); // 'Yes'
false.toYesNo(yes: 'On', no: 'Off'); // 'Off'

Implementation

String toYesNo({String yes = 'Yes', String no = 'No'}) => this ? yes : no;