cc young
cc young

Reputation: 20223

in Dart, what is the best way to know if a class has been defined?

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

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

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

Related Questions