Create Flutter boilerplate code with fewer typing with Android Studio Custom Live Templates

Flutter requires developers to write many boilerplate codes. Android Studio provides a way to solve the problem, which is Live Templates. Live templates allow you to use customized shorthand to write repetitive boilerplate codes. This article will show you how to use Live Templates to minimize the effort to write repeated code.

The image below shows how Live Templates work in Android Studio:

Creating Live Templates

1. start Android Studio

2. open Live Templates Preferences (Editor |Live Templates)

3. create Live Template Group

4. select the new template group

5. create a Live Template

6. add abbreviation (the shorthand that you want to use)

7. add a description (optional)

8. add template text

9. define a context (Dart |Top Level)

10. Save the template

The result should look like the image below:

Variables

Android Studio provides functions in the Expression tab to make variables more usable. Here is a list of functions that you may find useful:

  • camelCase(String)
  • capitalize(String)
  • fileName()
  • fileNameWithoutExtension()

Sharing Live Templates

Flutter Enhancement Suite

Closing thoughts

On the other note, if you want to work for a company that is:

  • The leader in the 3D body-scanning industry.
  • Collaborate and grow the company with tremendously smart and talented software developers in different skills.
  • You love working with the latest cutting edge technology like ARCore, Flutter, ARKit and so on.

Join us via using this link to submit your application and interest!

Mobile developer; Netvirta; Android; Flutter; Gradle; Kotlin