mohammed arshad
mohammed arshad

Reputation: 51

How to create own Flutter Template

I am wondering if I could create my own flutter template. just like android Native having in android studio.

flutter having a template selection in command, eg flutter create -t skeleton <project-name>

I have my own project structure and I want to add my custom template with that command just like flutter create -t <my_custom_template> <project-name>

Upvotes: 3

Views: 1320

Answers (2)

Yuriy N.
Yuriy N.

Reputation: 6127

Just a workaround for VS Code users.

We can:

  1. Create a template project
  2. Copy it to another folder
  3. Open this folder in VS Code
  4. Use rename package to rename app name and bundleId
  5. Manually rename .iml file and name in pubspec.yaml
  6. Optionally: If you get an error like "Cannot create link or file because it already exists" while building for Windows, delete windows/flutter/ephemeral folder

(I think something similar can be done in Android Studio as well).

Upvotes: 0

Vandad Nahavandipoor
Vandad Nahavandipoor

Reputation: 1574

I don't think that's possible at the moment. The best way to go about it is to create a code snippet in Visual Studio Code or in Android Studio as explained in this video: https://www.youtube.com/watch?v=g93mls_EJmU&ab_channel=VandadNahavandipoor

Upvotes: 2

Related Questions