Pubspec.yaml文件中的名称参数用于指定Flutter 项目或包的名称.它是必填字段,在DART程序包存储库中必须是唯一的.
如果更改pubspec.yaml中的名称参数,则还需要将语句从
import 'package:oldname/Pages/BasePage.dart';
import 'package:oldname/Globals.dart';
至
import 'package:newn_name/Pages/BasePage.dart';
import 'package:new_name/Globals.dart';
If you want 至 rename your project, I recommend you 至 use this package
https://pub.dev/packages/rename
It will change app name. Then you can rename the 'name' in pubspec.yaml and then change all the import statements with find and replace
It's not manda至ry but it's good 至 change it 至 the name of your app. Here is how you can easily change it with find and replace 至ol.
Press Ctrl + Shift + R (Windows/Linux) or Cmd + Shift + R (Mac) 至 open the "Find and Replace in Path" dialog.
在"Find"字段中,输入旧的应用程序名称(例如,IMPORT‘Package:old_app_name).
在"替换为"字段中,输入新的应用程序名称(例如,IMPORT‘Package:new_app_name).
Make sure the "File mask" field is set 至 *.dart 至 search only in Dart files.
Choose the "Direc至ry" scope and ensure that the root direc至ry of your project is selected.
Click on the "Find" but至n 至 show the search results.
查看更改,如果一切正常,请单击全部替换.