Last active
December 19, 2015 22:58
-
-
Save kevmoo/6030995 to your computer and use it in GitHub Desktop.
Dart Bug: mixins with aliased imports Repo for https://code.google.com/p/dart/issues/detail?id=11891
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
| library mixin_library; | |
| import 'dart:json' as json; | |
| class MixinClass { | |
| String bar() => json.stringify({'a':1}); | |
| } |
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
| import 'mixin_class.dart'; | |
| // Runtime error without this import | |
| // import 'dart:json' as json; | |
| class Oops extends Object with MixinClass { | |
| String baz() => bar(); | |
| } | |
| void main() { | |
| print("Hello, World!"); | |
| var oops = new Oops(); | |
| print(oops.baz()); | |
| } |
Author
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NoSuchMethodError : method not found: 'json'
Receiver: Instance of 'Oops'
Arguments: []
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:23:25)
#1 BaseClass&MixinClass.bar (file:///Users/kevin/Desktop/mixin_library_fun/bin/mixin_class.dart:7:19)
#2 Oops.baz (file:///Users/kevin/Desktop/mixin_library_fun/bin/mixin_library_fun.dart:9:36)
#3 main (file:///Users/kevin/Desktop/mixin_library_fun/bin/mixin_library_fun.dart:18:17)