Skip to content

Instantly share code, notes, and snippets.

View cktgh's full-sized avatar

Thomas cktgh

  • Hong Kong
  • 16:46 (UTC +08:00)
View GitHub Profile
@cktgh
cktgh / main.dart
Last active April 17, 2025 10:16
DartPad Template
//----------------------------------------------------------------------------//
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;
}