Skip to content

Instantly share code, notes, and snippets.

@BrianCraig
Created November 7, 2022 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrianCraig/5227427650d610304e36bddafa3e14ab to your computer and use it in GitHub Desktop.
Save BrianCraig/5227427650d610304e36bddafa3e14ab to your computer and use it in GitHub Desktop.
solar-kingdom-8851
abstract class IIsEmpty{
bool get isEmpty;
}
bool isEmptyList<T extends List>(T x) => x.isEmpty;
bool isEmptyMap<T extends Map>(T x) => x.isEmpty;
bool isEmpty<T extends IIsEmpty>(T x) => x.isEmpty;
void main() {
print(isEmptyList([]));
print(isEmptyMap({}));
print(isEmpty({}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment