When I use the cli to create a flutter app, a template app is created by google.
My question is, is there a way to create a custom template app instead of the default counter app by google, when I use the "flutter create my_app"?
Thanks in advance...
Create a simple, templated Flutter app, using the command
flutter create my_app
this argument commands are helpful to customize your starter app
--org
The organization responsible for your new Flutter project, in reverse domain name
notation. This string is used in Java package names and as prefix in the iOS bundle
identifier.
(defaults to "com.example")
--description
The description to use for your new Flutter project. This string ends up in the
pubspec.yaml file.
(defaults to "A new Flutter project.")
-i, --ios-language
you can set ios language from objc, swift
-a, --android-language
you can set ios language from java, kotlin
--platforms
The platforms supported by this project. This argument only works when the --template is
set to app or plugin. Platform folders (e.g. android/) will be generated in the target
project. When adding platforms to a plugin project, the pubspec.yaml will be updated with
the requested platform. Adding desktop platforms requires the corresponding desktop
config setting to be enabled.
[ios (default), android (default), windows (default), linux (default), macos (default),
web (default)]
-t, --template=<type>
Specify the type of project to create.
[app] (default) Generate a Flutter application.
[module] Generate a project to add a Flutter module to an existing Android or iOS application.
[package] Generate a shareable Flutter project containing modular Dart code.
[plugin] Generate a shareable Flutter project containing an API in Dart code with a
platform-specific implementation for Android, for iOS code, or for both.
-s, --sample=<id>
Specifies the Flutter code sample to use as the main.dart for an application. Implies
--template=app. The value should be the sample ID of the desired sample from the API
documentation website (http://docs.flutter.dev). An example can be found at
https://master-api.flutter.dev/flutter/widgets/SingleChildScrollView-class.html
--list-samples=<path>
Specifies a JSON output file for a listing of Flutter code samples that can be created
with --sample.
Run "flutter help" to see global options.
Related
I created a Flutter project in Android Studio. In the steps, I just selected 'Web' and now I also want Android and iOS in my project, but I don't know how to add those directories.
Open the project in your ide and in terminal enter
flutter create .
note that after create there is a period (full stop) which will create android, ios and web whichever isnt present in the project.
Or if you want to add specific platforms use
flutter create --platforms=android .
I want to create a new project in flutter using VS, but I want this project without the web dependence just a mobile app dependence but each time I create a project it gives me the dependence of the web, not a mobile app
For Example, this what I get:
This what I want
You can generate a flutter app for only mobile platforms with flutter create tool by specifying platforms.
flutter create <app_name> --platforms=android,ios
In the same way you enabled flutter web support, disable it.
flutter config --no-enable-web
This removes web support so that future created projects will not generate a web folder. You may need to restart any open editors for the changes to take place.
I'm working with Flutter to make a Mobile App using the stable Flutter SDK release. But I also want to try Flutter Desktop and Flutter Web that are not part of the Flutter stable channel yet, but are present on the Flutter dev channel.
My question is... How can I try Flutter Desktop and Flutter Web without override the Flutter stable release on my machine?
You'll need to setup alias to switch between different environments easily.
See here a detailed article for that.
I found this Dart package called Flutter Version Management that does exactly what I want.
As the docs says:
Flutter Version Management: A simple cli to manage Flutter SDK versions.
Features:
Configure and use Flutter SDK version per project
Ability to install and cache multiple Flutter SDK Versions
Fast switch between Flutter channels & versions
Dynamic SDK paths for IDE debugging support.
Version FVM config with a project for consistency across teams and CI environments.
Set global Flutter version across projects
https://github.com/leoafarias/fvm
Now I just need to add FVM_HOME/default/bin to the PATH and FVM will take care of everything...
Two solutions
Put the installation files in two different directories one with stable and the other dev and add one of them to the path then you can change the path variable when needed to use the other channel.
Put the flutter repository file in two different directories one with stable and the other with dev then,
add the first installation to the path then add an alias to point to the second installation directory.
How to create a new project using Flutter either for iOS or Android?
I tried with flutter create projectname but it is creating both iOS and Android platform.
Is it possible for any one platform?
You can use the --platforms parameter to specify which platforms you want to create the app for (defaults to all of them). So, if you want to create an app for only android you would do something like the following:
flutter create --platforms android my_app
Note: the -i and -a parameters are for selecting the language used, not restricting which platforms are generated.
Lastly: It does seem that you can simply delete the undesired platform directories after they are generated.
Just delete the android or ios folder created in the project.
You can also leave the folders and just not build for the platform you don't want to support.
The question is for creating a new project either for Android or iOS. Not for building.
Please follow the steps given in this tutorial Get Started.
In a nutshell
Get the Flutter SDK Update your path with flutter SDK
Run flutter doctor to make sure, flutter is installed correctly
Install the Flutter and Dart plugins for Android Studio
Create new flutter app by following this tutorial
Hope this helps
If you want to create only Android or iOS project just run
(--ios-language select between swift or object-c)
flutter create -i, --ios-language [objc (default), swift]
flutter create -a, --android-language [java (default), kotlin]
Same for android
How do I change the Native language to Swift & Kotlin from Objective-C & Java in VS Code while developing apps using Flutter Framework?
Previously I was using IntelliJ IDEA and while creating project I used to get options to select native language for both the iOS(Swift or Objective-C) & Android(Java or Kotlin) platform.
VS Code doesn't show such options.
Assuming you have installed Dart Code, the plugin doesn't prompt Android & iOS project language when creating new project.
Instead you can set the default in the settings.
Search for dart.flutterCreateAndroidLanguage and dart.flutterCreateIOSLanguage in VS Code settings.
By default flutter template supports writing Android code using Java, iOS code using Objective-C. To use Kotlin or Swift, use the -i and/or -a flags like so flutter create -i swift -a kotlin helloWorld
Default flutter create a language for android is java and for iOS is objective-c. To change, follow these steps:
Open vscode settings. Under User Settings or use [cmd+comma(,)] then click on Extensions.
Open Dart & Flutter
Scroll down till you see Flutter Create Android Language to change it to kotlin and Flutter Create IOSLanguage to change it to swift
vscode user settings
flutter create language change