Reputation: 20223
in my program, I wish to different behavior depending on whether a class has been defined.
if one had undefined
as in javascript
, something like this:
var i = (NewClass == undefined) ? new OldClass() : new NewClass();
since Dart is compiled, can something like this be done?
seems the best answer is to search for the class NewClass
using the string "NewClass". see Instantiate a class from a string
Upvotes: 1
Views: 158
Reputation: 657731
I'm not sure what you actually want to express.
In Dart you can't dynamically define classes (at least not yet)
therefore such an if makes no sense.
Upvotes: 2