Created with <3 with dartpad.dev.
Last active
August 4, 2022 15:16
-
-
Save om-ha/2cdd8a32e72360ef4813bd75ec115578 to your computer and use it in GitHub Desktop.
divine-utopia-3406
This file contains 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
void main() { | |
final MyType myType = MyType(); | |
myMethod<MyType>(myType); | |
} | |
void myMethod<T>(T? value) { | |
bool isMyInterface; | |
bool isMyMixin; | |
isMyInterface = value is MyInterface?; | |
isMyMixin = value is MyMixin?; | |
print('`MyInterface?` $isMyInterface'); // `false` with freezed | |
print('`MyMixin?` $isMyMixin'); // `false` with freezed | |
print(''); | |
isMyInterface = value is MyInterface; | |
isMyMixin = value is MyMixin; | |
print('`MyInterface` $isMyInterface'); // `false` with freezed | |
print('`MyMixin` $isMyMixin'); // `false` with freezed | |
print(''); | |
print('value.runtimeType ${value.runtimeType}'); // `_$_MyType` with freezed | |
print('T $T'); // `MyType?` with freezed | |
} | |
abstract class MyInterface {} | |
mixin MyMixin {} | |
class MyType with MyMixin implements MyInterface {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment