class Bob { String response(String input) { if (input.isQuestion && input.isUppercase) return "Calm down, I know what I'm doing!"; if (input.isQuestion) return "Sure."; if (input.isUppercase) return "Whoa, chill out!"; if (input.isNothing) return "Fine. Be that way!"; return "Whatever."; } } extension on String { bool get isQuestion => this.trim().endsWith('?'); bool get isUppercase => this == this.toUpperCase() && this != this.toLowerCase(); bool get isNothing => this.contains('silence') || this.trim().isEmpty; }