mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Fix line-wrapping in flutter create
error message. (#150325)
This commit is contained in:
parent
a0e75cd309
commit
20bc0a9cb8
@ -857,16 +857,15 @@ String? potentialValidPackageName(String name){
|
||||
String? _validateProjectName(String projectName) {
|
||||
if (!isValidPackageName(projectName)) {
|
||||
final String? potentialValidName = potentialValidPackageName(projectName);
|
||||
|
||||
return <String>[
|
||||
'"$projectName" is not a valid Dart package name.',
|
||||
'\n\n',
|
||||
'The name should be all lowercase, with underscores to separate words, "just_like_this".',
|
||||
'Use only basic Latin letters and Arabic digits: [a-z0-9_].',
|
||||
"Also, make sure the name is a valid Dart identifier—that it doesn't start with digits and isn't a reserved word.\n",
|
||||
'See https://dart.dev/tools/pub/pubspec#name for more information.',
|
||||
if (potentialValidName != null) '\nTry "$potentialValidName" instead.',
|
||||
].join();
|
||||
return '"$projectName" is not a valid Dart package name.'
|
||||
'${ potentialValidName != null ? ' Try "$potentialValidName" instead.' : '' }\n'
|
||||
'\n'
|
||||
'The name should consist of lowercase words separated by underscores, "like_this". '
|
||||
'Use only basic Latin letters and Arabic digits: [a-z0-9_], and '
|
||||
'ensure the name is a valid Dart identifier '
|
||||
'(i.e. it does not start with a digit and is not a reserved word).\n'
|
||||
'\n'
|
||||
'See https://dart.dev/tools/pub/pubspec#name for more information.';
|
||||
}
|
||||
if (_packageDependencies.contains(projectName)) {
|
||||
return "Invalid project name: '$projectName' - this will conflict with Flutter "
|
||||
|
@ -838,9 +838,15 @@ void main() {
|
||||
<String>['--no-pub', '--template=plugin', '--project-name', 'xyz-xyz', '--platforms', 'android,ios',],
|
||||
<String>[],
|
||||
),
|
||||
allOf(
|
||||
throwsToolExit(message: '"xyz-xyz" is not a valid Dart package name.'),
|
||||
throwsToolExit(message: 'Try "xyz_xyz" instead.'),
|
||||
throwsToolExit(message:
|
||||
'"xyz-xyz" is not a valid Dart package name. Try "xyz_xyz" instead.\n'
|
||||
'\n'
|
||||
'The name should consist of lowercase words separated by underscores, '
|
||||
'"like_this". Use only basic Latin letters and Arabic digits: [a-z0-9_], '
|
||||
'and ensure the name is a valid Dart identifier (i.e. it does not start '
|
||||
'with a digit and is not a reserved word).\n'
|
||||
'\n'
|
||||
'See https://dart.dev/tools/pub/pubspec#name for more information.'
|
||||
),
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user