isBoolean function

bool isBoolean (dynamic input)

check if a string input represents boolean value like true , false , 0 , 1

Implementation

bool isBoolean(input) {
  return (['true', 'false', '1', '0'].indexOf(input.toString()) >= 0);
}