Created
October 21, 2022 21:50
-
-
Save ruan65/e3ef5dbd243b1a89c4ee7349c06f7f03 to your computer and use it in GitHub Desktop.
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 CompactMap<T> on Iterable<T?> { | |
Iterable<T> compactMap<E>([E? Function(T?)? transform]) => | |
map(transform ?? (e) => e).where((e) => e != null).cast(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment