Skip to content

Instantly share code, notes, and snippets.

@iapicca
Created April 28, 2024 14:41
Show Gist options
  • Save iapicca/ca267d0aa7c167c05d12e04b84a9655a to your computer and use it in GitHub Desktop.
Save iapicca/ca267d0aa7c167c05d12e04b84a9655a to your computer and use it in GitHub Desktop.
extensio types stop being Object
import 'dart:ui';
typedef SomethingToString<T extends Object> = void Function(T);
class Foo extends Object {
const Foo();
}
extension type Bar(Foo foo) {}
class Baz {
const Baz();
}
extension type MyOffset(Offset offset) {}
SomethingToString<Foo> get fooHello => (i) => 'hello';
SomethingToString<Bar> get barHello => (i) => 'hello';
SomethingToString<Baz> get bazHello => (i) => 'hello';
SomethingToString<Offset> get offsetHello => (i) => 'hello';
SomethingToString<MyOffset> get myOffsetHello => (i) => 'hello';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment