在升級flutter1.9+之后,flutter默認的iOS項目為swift,Android的默認項目為kotlin,而且通過IDEA創建的flutter項目,即使勾選了語言為oc,但是創建后的項目仍然是swift,頗為頭疼.
那么我們修改創建項目項目的語言呢,
首先查看flutter create 支持哪些sub commands
~/Desktop/testcode/ flutter create No option specified for the output directory. Create a new Flutter project. If run on a project that already exists, this will repair the project, recreating any files that are missing. Usage: flutter create <output directory> -h, --help Print this usage information. --[no-]pub Whether to run "flutter pub get" after the project has been created. (defaults to on) --[no-]offline When "flutter pub get" is run by the create command, this indicates whether to run it in offline mode or not. In offline mode, it will need to have all dependencies already available in the pub cache to succeed. --[no-]with-driver-test Also add a flutter_driver dependency and generate a sample 'flutter drive' test. -t, --template=<type> Specify the type of project to create. [app] (default) Generate a Flutter 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/Si ngleChildScrollView-class.html --list-samples=<path> Specifies a JSON output file for a listing of Flutter code samples that can created with --sample. --[no-]overwrite When performing operations, overwrite existing files. --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.") --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") --project-name The project name for this new Flutter project. This must be a valid dart package name. -i, --ios-language [objc, swift (default)] -a, --android-language [java, kotlin (default)] --[no-]androidx Generate a project using the AndroidX support libraries Run "flutter help" to see global options.
在創建項目時,比如我們想修改iOS的語言為oc,那么執行以下命令:
flutter create -i objc flutteroc