Last active
April 17, 2025 10:16
-
-
Save cktgh/af62e416c97e70a0001a623846fbb768 to your computer and use it in GitHub Desktop.
DartPad Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//----------------------------------------------------------------------------// | |
extension KtScopeFunction<T> on T { | |
R let<R>(R Function(T it) block) => block(this); | |
T also(void Function(T it) block) { block(this); return this; } | |
T? takeIf(bool Function(T it) predicate) => predicate(this) ? this : null; | |
T? takeUnless(bool Function(T it) predicate) => predicate(this) ? null : this; | |
} | |
T run<T>(T Function() block) => block(); | |
// ignore: non_constant_identifier_names | |
Never TODO([String? message]) => | |
throw UnimplementedError(message ?? '`TODO` not implemented.'); | |
extension Tlog<T> on T { | |
T log([Object Function(T)? transform]) { | |
print((transform?.call(this) ?? this).toString()); | |
return this; | |
} | |
} | |
//----------------------------------------------------------------------------// | |
void main() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment