user2267395
user2267395

Reputation: 169

What is the equivalent of AS3's foo:* in Dart?

I just started using Dart, and I haven't been able to find answers to these issues.

How do these three AS3 lines translate into Dart?

1) static var asset:*; <<-- basically how do I handle * type

2) static function getAsset():* { <<-- same issue, how do I handle * type?

3) static function loadImages(... images):void { << -- how do I handle ... argument?

Upvotes: 2

Views: 179

Answers (1)

Darshan Rivka Whittle
Darshan Rivka Whittle

Reputation: 34031

I don't know ActionScript, but some quick Googling suggests that the asterisk means "can be any type". Since Dart is optionally typed, this means you can just leave the type off. I believe static works about the same in both languages.

So:

1) static var asset:*; becomes static var asset;

2) static function getAsset():* { becomes static getAsset() {

3) Dart doesn't support varargs, but this answer has a workaround.

Upvotes: 1

Related Questions