Skip to content

Instantly share code, notes, and snippets.

@heftekharm
Created November 25, 2021 15:43
Show Gist options
  • Save heftekharm/fcd1f28e0f7b7f8e0cbaf79f8f5f645b to your computer and use it in GitHub Desktop.
Save heftekharm/fcd1f28e0f7b7f8e0cbaf79f8f5f645b to your computer and use it in GitHub Desktop.
class Circle<T extends num> {
final T size;
Circle(this.size);
factory Circle.createWithFactory(T size) => Circle<T>(size);
static Circle<T> createWithStatic<T extends num>(T size) => Circle<T>(size);
}
void main() {
var c1 = Circle<int>.createWithFactory(5);
var c2 = Circle.createWithStatic<int>(5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment