Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to create a local variable with a specific type? #38

Closed
zoechi opened this issue Nov 30, 2016 · 2 comments
Closed

Is there a way to create a local variable with a specific type? #38

zoechi opened this issue Nov 30, 2016 · 2 comments

Comments

@zoechi
Copy link
Contributor

zoechi commented Nov 30, 2016

mainMethod.addStatement(literal('foo').asFinal('bar'));

generates

final bar = 'foo';

I tried to get

final String bar = 'foo';

I know the type isn't necessary. Still curious if this is supported.

@matanlurey
Copy link
Contributor

matanlurey commented Nov 30, 2016

import 'package:code_builder/dart/core.dart';

literal('foo').asFinal('bar', type: lib$core.String)

?

@zoechi
Copy link
Contributor Author

zoechi commented Nov 30, 2016

Great, thanks. Missed that parameter.

@zoechi zoechi closed this as completed Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants