i dont know, after flutter 3.0.0 update, i can’t use snippet in android studio. maybe i can, but inside a function. i cant easily import material.dart. but i used snippet in it worked (i can use snippet without flutter snipet plugin in android studio before).
this flutter snippet didn’t work inside statefull widget,
i can use snippet before finally using flutter snippet plugin, but when i upgrade flutter to 3.0.0, i cant use it. and when i use flutter snippet plugin, i can’t do like @override.
i’ve try updating all the plugin, reinstalling android studio, but it doesn’t work.
any solution ?
i’ve already comfortable making flutter app with android studio, and i actually doesn’t wanted to use vscode to make flutter app..
3
Answers
You need to write in Widget build function. Currently you are in the wrong scope
Same here. So how i solved this issue! I just use
Ctrl+O
for overriding any method.N:B sometimes hints don’t work. so I have to press
ESC
a couple of times or navigate to another page and come back again.Me too, after I’ve updated flutter and android studio on my Ubuntu 22 I can’t use
initState
andsetState
snippet even I’ve installed snippet plugin. Then I can use it again by changing Live Template setting, but not like before (works onStatefulWidget
only). You can follow this steps:Open File->Settings->Editor->Live Templates->Flutter then click
initS
Click Change button on the bottom and check mark Flutter then click Apply
Finish, you can use
initState
snippet now.You can add
setState
or other template you want by clicking+
button on top-right and fill all needed.Happy coding!
🙂