Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove an unnecessary dynamic #2239

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions pkgs/test_core/lib/src/runner/console.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import '../util/io.dart';
/// An interactive console for taking user commands.
class Console {
/// The registered commands.
final _commands = <String, _Command>{};
final _commands = <String,
natebosch marked this conversation as resolved.
Show resolved Hide resolved
({String name, String description, FutureOr<void> Function() body})>{};

/// The pending next line of standard input, if we're waiting on one.
CancelableOperation? _nextLine;
Expand Down Expand Up @@ -54,7 +55,7 @@ class Console {
throw ArgumentError('The console already has a command named "$name".');
}

_commands[name] = _Command(name, description, body);
_commands[name] = (name: name, description: description, body: body);
}

/// Starts running the console.
Expand Down Expand Up @@ -101,17 +102,3 @@ class Console {
}
}
}

/// An individual console command.
class _Command {
kevmoo marked this conversation as resolved.
Show resolved Hide resolved
/// The name of the command.
final String name;

/// The single-line description of the command.
final String description;

/// The callback to run when the command is invoked.
final FutureOr<void> Function() body;

_Command(this.name, this.description, this.body);
}
Loading