flutterandroid-studiocode-snippets

Flutter snippet didn't work in statefull widget android studio


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,

enter image description here

but it works inside function. enter image description here

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..


Solution

  • Me too, after I've updated flutter and android studio on my Ubuntu 22 I can't use initState and setState snippet even I've installed snippet plugin. Then I can use it again by changing Live Template setting, but not like before (works on StatefulWidget only). You can follow this steps:

    1. Open File->Settings->Editor->Live Templates->Flutter then click initS enter image description here

    2. Click Change button on the bottom and check mark Flutter then click Apply enter image description here

    3. 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! :)