|
|
@ -1,16 +1,16 @@ |
|
|
|
/// https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/lib/scope_functions.dart |
|
|
|
/// https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/lib/scope_functions.dart |
|
|
|
/// MIT license: https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/LICENSE |
|
|
|
/// MIT license: https://github.com/YusukeIwaki/dart-kotlin_flavor/blob/74593dada94bdd8ca78946ad005d3a2624dc833f/LICENSE |
|
|
|
|
|
|
|
|
|
|
|
ReturnType run<ReturnType>(ReturnType operation()) { |
|
|
|
ReturnType run<ReturnType>(ReturnType Function() operation) { |
|
|
|
return operation(); |
|
|
|
return operation(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
extension ScopeFunctionsForObject<T extends Object> on T { |
|
|
|
extension ScopeFunctionsForObject<T extends Object> on T { |
|
|
|
ReturnType let<ReturnType>(ReturnType operationFor(T self)) { |
|
|
|
ReturnType let<ReturnType>(ReturnType Function(T self) operationFor) { |
|
|
|
return operationFor(this); |
|
|
|
return operationFor(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
T also(void operationFor(T self)) { |
|
|
|
T also(void Function(T self) operationFor) { |
|
|
|
operationFor(this); |
|
|
|
operationFor(this); |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|