-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[flutter_plugin_tools] Complete migration to NNBD #4048
[flutter_plugin_tools] Complete migration to NNBD #4048
Conversation
cyanglaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % nits
| final String? remoteUrl = await _verifyRemote(remoteName); | ||
| if (remoteUrl == null) { | ||
| printError( | ||
| 'Unable to find URL for remote $remoteName; cannot push tags'); | ||
| throw ToolExit(1); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: Can refactor this into _RemoteInfo()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think putting very non-trivial logic (running an external process, potentially killing the whole execution) in the constructor of a data class would be much less clear; keeping it as a simple data object with the logic outside it makes the object, and the failure cases, easier to understand IMO.
|
|
||
| Future<String> _verifyRemote(String remote) async { | ||
| Future<String?> _verifyRemote(String remote) async { | ||
| final io.ProcessResult remoteInfo = await processRunner.run( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: Maybe have a different name here as there is a RemoteInfo class now and it might be confusing.
maybe getRemoteUrlResult?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
|
||
| /// The path in which pub expects to find its credentials file. | ||
| final String _credentialsPath = () { | ||
| final String? _credentialsPath = () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits:
maybe we can move the above logic in _ensureValidPubCredential:
final String? credentialsPath = _credentialsPath;
if (credentialsPath == null) {
printError('Unable to determine pub credentials path');
throw ToolExit(1);
}
here, so _credentialsPath can return a non-null String, then static String? getCredentialPath() can also return a non-null String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good thought, done.
|
This pull request is not suitable for automatic merging in its current state.
|
cyanglaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM % nits. CI failure should be an easy fix too.
|
|
||
| void _ensureValidPubCredential() { | ||
| final String credentialsPath = _credentialsPath; | ||
| final File credentialFile = packagesDir.fileSystem.file(_credentialsPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits:
| final File credentialFile = packagesDir.fileSystem.file(_credentialsPath); | |
| final File credentialFile = packagesDir.fileSystem.file(credentialsPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Migrates the publish command to NNBD.
This is the last command, so the top-level files are migrated as well, allowing the tool to run in strong mode.
Fixes flutter/flutter#81912
Pre-launch Checklist
dart format.)[shared_preferences]///).