From f0bbfcf71341940e9749f7e27d22c71aaf0ee5f6 Mon Sep 17 00:00:00 2001 From: Gorniaky Date: Wed, 26 Aug 2026 13:33:57 -0300 Subject: [PATCH] refactor: update constructors to use 'new' keyword for consistency - Changed all constructors in the codebase to use the 'new' keyword for consistency and clarity. - Updated various command classes in the 'lib/commands' directory. - Modified exception handling in 'lib/services/discloud/exception.dart' and related files. - Adjusted factory constructors in 'lib/services/discloud/api_client.dart' and 'lib/services/discloud/user_agent.dart'. - Refactored local store and nested map modules to align with the new constructor style. - Updated pubspec.yaml files across multiple modules to reflect Dart SDK version changes. --- analysis_options.yaml | 7 ++++- lib/cli/context.dart | 4 +-- lib/cli/printer/console_printer.dart | 6 ++--- lib/cli/printer/debug_console_printer.dart | 2 +- lib/cli/runner.dart | 3 +-- lib/cli/spin/cli_spin.dart | 4 +-- lib/cli/spin/timer_cli_spin.dart | 2 +- lib/commands/app.dart | 2 +- lib/commands/app/apt.dart | 2 +- lib/commands/app/apt/install.dart | 2 +- lib/commands/app/apt/uninstall.dart | 2 +- lib/commands/app/backup.dart | 5 ++-- lib/commands/app/commit.dart | 2 +- lib/commands/app/console.dart | 2 +- lib/commands/app/delete.dart | 2 +- lib/commands/app/info.dart | 2 +- lib/commands/app/logs.dart | 8 +++--- lib/commands/app/mod.dart | 2 +- lib/commands/app/mod/add.dart | 2 +- lib/commands/app/mod/delete.dart | 2 +- lib/commands/app/mod/edit.dart | 2 +- lib/commands/app/mod/info.dart | 3 ++- lib/commands/app/profile.dart | 2 +- lib/commands/app/ram.dart | 2 +- lib/commands/app/restart.dart | 2 +- lib/commands/app/start.dart | 2 +- lib/commands/app/status.dart | 2 +- lib/commands/app/stop.dart | 2 +- lib/commands/app/upload.dart | 2 +- lib/commands/domain.dart | 2 +- lib/commands/domain/create.dart | 2 +- lib/commands/domain/delete.dart | 2 +- lib/commands/domain/edit.dart | 2 +- lib/commands/domain/info.dart | 2 +- lib/commands/domain/verify.dart | 2 +- lib/commands/init.dart | 7 +++-- lib/commands/snapshot.dart | 2 +- lib/commands/snapshot/create.dart | 2 +- lib/commands/snapshot/download.dart | 5 ++-- lib/commands/snapshot/info.dart | 2 +- lib/commands/subdomain.dart | 2 +- lib/commands/subdomain/create.dart | 2 +- lib/commands/subdomain/delete.dart | 2 +- lib/commands/subdomain/info.dart | 2 +- lib/commands/system.dart | 2 +- lib/commands/system/locale.dart | 2 +- lib/commands/team.dart | 2 +- lib/commands/team/backup.dart | 5 ++-- lib/commands/team/commit.dart | 2 +- lib/commands/team/info.dart | 2 +- lib/commands/team/logs.dart | 8 +++--- lib/commands/team/ram.dart | 2 +- lib/commands/team/restart.dart | 2 +- lib/commands/team/start.dart | 2 +- lib/commands/team/status.dart | 2 +- lib/commands/team/stop.dart | 2 +- lib/commands/user.dart | 2 +- lib/commands/user/locale.dart | 2 +- lib/commands/wait.dart | 2 +- lib/commands/zip.dart | 2 +- lib/services/discloud/api_client.dart | 4 +-- lib/services/discloud/exception.dart | 14 +++++----- lib/services/discloud/exception.freezed.dart | 27 ++++++++++--------- lib/services/discloud/user_agent.dart | 2 +- lib/utils/bytes.dart | 10 +++---- lib/utils/messages.dart | 5 ++-- lib/utils/progress.dart | 2 +- lib/utils/signal_wrapper.dart | 10 +++---- lib/utils/speed_monitor.dart | 6 ++--- modules/glob_zipper/lib/src/exception.dart | 2 +- modules/glob_zipper/lib/src/fs.dart | 7 +++-- modules/glob_zipper/lib/src/glob_zipper.dart | 2 +- modules/glob_zipper/lib/src/zip_progress.dart | 2 +- modules/glob_zipper/pubspec.yaml | 2 +- modules/interact/lib/src/confirm.dart | 9 +++---- .../interact/lib/src/framework/context.dart | 2 +- modules/interact/lib/src/input.dart | 6 ++--- modules/interact/lib/src/integer.dart | 2 +- modules/interact/lib/src/multi_select.dart | 4 +-- modules/interact/lib/src/password.dart | 4 +-- modules/interact/lib/src/progress.dart | 6 ++--- modules/interact/lib/src/select.dart | 4 +-- modules/interact/lib/src/sort.dart | 4 +-- modules/interact/lib/src/spinner.dart | 6 ++--- modules/interact/lib/src/theme/theme.dart | 2 +- modules/interact/pubspec.yaml | 2 +- .../local_store/lib/src/json_local_store.dart | 2 +- modules/local_store/lib/src/local_store.dart | 2 +- modules/local_store/pubspec.yaml | 2 +- modules/nested_map/pubspec.yaml | 2 +- pubspec.yaml | 10 +++---- scripts/docs/generate.dart | 6 ++--- 92 files changed, 161 insertions(+), 170 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 136a379..a5e831a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -86,7 +86,9 @@ linter: - cascade_invocations - combinators_ordering - directives_ordering + - empty_container_bodies - eol_at_end_of_file + - initialize_in_field_declaration - no_literal_bool_comparisons - noop_primitive_operations - prefer_const_constructors @@ -102,13 +104,16 @@ linter: - require_trailing_commas - simplify_variable_pattern - unawaited_futures - - unnecessary_await_in_return + - unnecessary_const_in_enum_constructor - unnecessary_ignore - unnecessary_lambdas - unnecessary_parenthesis + - unnecessary_primary_constructor_body - unnecessary_raw_strings + - unnecessary_type_name_in_constructor - unnecessary_unawaited - use_colored_box + - use_declaring_parameters - use_decorated_box - use_enums - use_named_constants diff --git a/lib/cli/context.dart b/lib/cli/context.dart index ba1c479..90eecd6 100644 --- a/lib/cli/context.dart +++ b/lib/cli/context.dart @@ -18,7 +18,7 @@ part "paths.dart"; class CliContext implements Disposable { static late final CliContext I; - factory CliContext(Iterable arguments) { + factory(Iterable arguments) { final bool debug = arguments.contains("--debug"); return I = ._( @@ -32,7 +32,7 @@ class CliContext implements Disposable { ); } - const CliContext._({ + const new _({ required this.api, required this.arguments, required this.debug, diff --git a/lib/cli/printer/console_printer.dart b/lib/cli/printer/console_printer.dart index 218a040..3ca916c 100644 --- a/lib/cli/printer/console_printer.dart +++ b/lib/cli/printer/console_printer.dart @@ -7,11 +7,11 @@ import "package:discloud/cli/spin/ispin.dart"; part "debug_console_printer.dart"; class ConsolePrinter implements IPrinter { - factory ConsolePrinter._debug() = _DebugConsolePrinter; + factory _debug() = _DebugConsolePrinter; - factory ConsolePrinter({bool isDebug = false}) => isDebug ? ._debug() : ._(); + factory({bool isDebug = false}) => isDebug ? ._debug() : ._(); - ConsolePrinter._(); + new _(); ISpin? _spin; diff --git a/lib/cli/printer/debug_console_printer.dart b/lib/cli/printer/debug_console_printer.dart index bbf479a..d428a7c 100644 --- a/lib/cli/printer/debug_console_printer.dart +++ b/lib/cli/printer/debug_console_printer.dart @@ -1,7 +1,7 @@ part of "console_printer.dart"; class _DebugConsolePrinter extends ConsolePrinter { - _DebugConsolePrinter() : super._(); + new() : super._(); void _debugSpin(ISpin spin, Object? object) { spin.stop(); diff --git a/lib/cli/runner.dart b/lib/cli/runner.dart index 27dfc14..db721c3 100644 --- a/lib/cli/runner.dart +++ b/lib/cli/runner.dart @@ -8,8 +8,7 @@ import "package:discloud/commands/wait.dart"; import "package:discloud/version.dart"; class CliCommandRunner extends CommandRunner { - CliCommandRunner() - : super("discloud", "A fast option to manage your apps on Discloud.") { + new() : super("discloud", "A fast option to manage your apps on Discloud.") { argParser ..addFlag( "debug", diff --git a/lib/cli/spin/cli_spin.dart b/lib/cli/spin/cli_spin.dart index e2b9ded..9e7e953 100644 --- a/lib/cli/spin/cli_spin.dart +++ b/lib/cli/spin/cli_spin.dart @@ -11,10 +11,10 @@ part "timer_cli_spin.dart"; void _noop() {} class CLISpin implements ISpin { - factory CLISpin({String? text, bool showDuration = false}) => + factory({String? text, bool showDuration = false}) => showDuration ? _TimerCLISpin._(text: text) : ._(.new(text: text)); - const CLISpin._(this._spin); + const new _(this._spin); final CliSpin _spin; diff --git a/lib/cli/spin/timer_cli_spin.dart b/lib/cli/spin/timer_cli_spin.dart index 0226dbc..76046fb 100644 --- a/lib/cli/spin/timer_cli_spin.dart +++ b/lib/cli/spin/timer_cli_spin.dart @@ -6,7 +6,7 @@ class _TimerCLISpin extends CLISpin { return null; } - _TimerCLISpin._({String? text}) + new _({String? text}) : _stopwatch = .new()..start(), _timer = .new(.zero, _noop), super._(.new(text: text)) { diff --git a/lib/commands/app.dart b/lib/commands/app.dart index 0b67813..6ec6b87 100644 --- a/lib/commands/app.dart +++ b/lib/commands/app.dart @@ -16,7 +16,7 @@ import "package:discloud/commands/app/stop.dart"; import "package:discloud/commands/app/upload.dart"; final class AppCommand extends Command { - AppCommand() { + new() { addSubcommand(AppAptCommand()); addSubcommand(AppBackupCommand()); addSubcommand(AppCommitCommand()); diff --git a/lib/commands/app/apt.dart b/lib/commands/app/apt.dart index dec0e4f..4ee16a4 100644 --- a/lib/commands/app/apt.dart +++ b/lib/commands/app/apt.dart @@ -3,7 +3,7 @@ import "package:discloud/commands/app/apt/install.dart"; import "package:discloud/commands/app/apt/uninstall.dart"; final class AppAptCommand extends Command { - AppAptCommand() { + new() { addSubcommand(AppAptInstallCommand()); addSubcommand(AppAptUninstallCommand()); } diff --git a/lib/commands/app/apt/install.dart b/lib/commands/app/apt/install.dart index 8032662..f78aeed 100644 --- a/lib/commands/app/apt/install.dart +++ b/lib/commands/app/apt/install.dart @@ -6,7 +6,7 @@ import "package:discloud/services/discloud/constants.dart"; import "package:discloud/utils/messages.dart"; final class AppAptInstallCommand extends Command { - AppAptInstallCommand() { + new() { argParser ..addOption("app") ..addMultiOption("apt", help: appApts.join(",")); diff --git a/lib/commands/app/apt/uninstall.dart b/lib/commands/app/apt/uninstall.dart index fcd8581..4e12ac6 100644 --- a/lib/commands/app/apt/uninstall.dart +++ b/lib/commands/app/apt/uninstall.dart @@ -6,7 +6,7 @@ import "package:discloud/services/discloud/constants.dart"; import "package:discloud/utils/messages.dart"; final class AppAptUninstallCommand extends Command { - AppAptUninstallCommand() { + new() { argParser ..addOption("app") ..addMultiOption("apt", help: appApts.join(",")); diff --git a/lib/commands/app/backup.dart b/lib/commands/app/backup.dart index 632254c..63873cf 100644 --- a/lib/commands/app/backup.dart +++ b/lib/commands/app/backup.dart @@ -13,15 +13,14 @@ import "package:discloud/utils/speed_monitor.dart"; import "package:path/path.dart" hide context; final class AppBackupCommand extends Command with Disposable { - AppBackupCommand() { + new() { argParser ..addOption("app", valueHelp: "all") ..addOption( "dir", abbr: "d", aliases: const ["out", "path"], - help: - "Specifies the destination path for downloading backups. The destination path will be considered a directory.", + help: "Specifies the destination path for downloading backups. The destination path will be considered a directory.", ); } diff --git a/lib/commands/app/commit.dart b/lib/commands/app/commit.dart index 33339c3..0038f9c 100644 --- a/lib/commands/app/commit.dart +++ b/lib/commands/app/commit.dart @@ -14,7 +14,7 @@ import "package:discloud_config/discloud_config.dart"; import "package:path/path.dart" hide context; final class AppCommitCommand extends Command with Disposable { - AppCommitCommand() { + new() { argParser ..addOption( "app", diff --git a/lib/commands/app/console.dart b/lib/commands/app/console.dart index b9941f0..23609e8 100644 --- a/lib/commands/app/console.dart +++ b/lib/commands/app/console.dart @@ -11,7 +11,7 @@ const _commandPrefix = "\x1B[2m?> \x1B[22m"; const _exitCommand = "exit"; final class AppConsoleCommand extends Command { - AppConsoleCommand() { + new() { argParser ..addOption("app") ..addMultiOption("command", abbr: "c"); diff --git a/lib/commands/app/delete.dart b/lib/commands/app/delete.dart index 5c6ec44..0024628 100644 --- a/lib/commands/app/delete.dart +++ b/lib/commands/app/delete.dart @@ -6,7 +6,7 @@ import "package:discloud/utils/messages.dart"; import "package:interact/interact.dart"; final class AppDeleteCommand extends Command { - AppDeleteCommand() { + new() { argParser ..addFlag( "yes", diff --git a/lib/commands/app/info.dart b/lib/commands/app/info.dart index ddc5430..a9b1fe4 100644 --- a/lib/commands/app/info.dart +++ b/lib/commands/app/info.dart @@ -20,7 +20,7 @@ const _keysIgnore = { }; final class AppInfoCommand extends Command { - AppInfoCommand() { + new() { argParser.addOption("app", valueHelp: "all"); } diff --git a/lib/commands/app/logs.dart b/lib/commands/app/logs.dart index 9e51386..d82d41a 100644 --- a/lib/commands/app/logs.dart +++ b/lib/commands/app/logs.dart @@ -9,19 +9,17 @@ import "package:discloud/utils/messages.dart"; import "package:path/path.dart" hide context; final class AppLogsCommand extends Command { - AppLogsCommand() { + new() { argParser ..addOption( "app", valueHelp: "all", - help: - "When set to 'all', this command will automatically download logs and will not display URLs. If the 'out' option is not set, downloads will be made to the current folder.", + help: "When set to 'all', this command will automatically download logs and will not display URLs. If the 'out' option is not set, downloads will be made to the current folder.", ) ..addOption( "out", aliases: const ["path"], - help: - "Specifies the destination path for downloading logs. When the application option is set to 'all', the destination path will be considered a directory where all downloads will be stored.", + help: "Specifies the destination path for downloading logs. When the application option is set to 'all', the destination path will be considered a directory where all downloads will be stored.", ); } diff --git a/lib/commands/app/mod.dart b/lib/commands/app/mod.dart index 580827a..6d21888 100644 --- a/lib/commands/app/mod.dart +++ b/lib/commands/app/mod.dart @@ -5,7 +5,7 @@ import "package:discloud/commands/app/mod/edit.dart"; import "package:discloud/commands/app/mod/info.dart"; final class AppModCommand extends Command { - AppModCommand() { + new() { addSubcommand(AppModAddCommand()); addSubcommand(AppModDeleteCommand()); addSubcommand(AppModEditCommand()); diff --git a/lib/commands/app/mod/add.dart b/lib/commands/app/mod/add.dart index 44e837d..83f083b 100644 --- a/lib/commands/app/mod/add.dart +++ b/lib/commands/app/mod/add.dart @@ -6,7 +6,7 @@ import "package:discloud/services/discloud/constants.dart"; import "package:discloud/utils/messages.dart"; final class AppModAddCommand extends Command { - AppModAddCommand() { + new() { argParser ..addOption("app") ..addOption("mod") diff --git a/lib/commands/app/mod/delete.dart b/lib/commands/app/mod/delete.dart index 9b2ce8f..96ef4f7 100644 --- a/lib/commands/app/mod/delete.dart +++ b/lib/commands/app/mod/delete.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class AppModDeleteCommand extends Command { - AppModDeleteCommand() { + new() { argParser ..addOption("app") ..addOption("mod"); diff --git a/lib/commands/app/mod/edit.dart b/lib/commands/app/mod/edit.dart index 3665fbb..843c185 100644 --- a/lib/commands/app/mod/edit.dart +++ b/lib/commands/app/mod/edit.dart @@ -6,7 +6,7 @@ import "package:discloud/services/discloud/constants.dart"; import "package:discloud/utils/messages.dart"; final class AppModEditCommand extends Command { - AppModEditCommand() { + new() { argParser ..addOption("app") ..addOption("mod") diff --git a/lib/commands/app/mod/info.dart b/lib/commands/app/mod/info.dart index 85d46fa..de79b5a 100644 --- a/lib/commands/app/mod/info.dart +++ b/lib/commands/app/mod/info.dart @@ -1,11 +1,12 @@ import "dart:async"; + import "package:args/command_runner.dart"; import "package:discloud/extensions/command.dart"; import "package:discloud/utils/ascii_table.dart"; import "package:discloud/utils/messages.dart"; final class AppModInfoCommand extends Command { - AppModInfoCommand() { + new() { argParser.addOption("app"); } diff --git a/lib/commands/app/profile.dart b/lib/commands/app/profile.dart index 4bbd669..96d09eb 100644 --- a/lib/commands/app/profile.dart +++ b/lib/commands/app/profile.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class AppProfileCommand extends Command { - AppProfileCommand() { + new() { argParser ..addOption("app") ..addOption("name", abbr: "n") diff --git a/lib/commands/app/ram.dart b/lib/commands/app/ram.dart index 680bbdc..73e5684 100644 --- a/lib/commands/app/ram.dart +++ b/lib/commands/app/ram.dart @@ -7,7 +7,7 @@ import "package:discloud/utils/messages.dart"; import "package:discloud_config/discloud_config.dart"; final class AppRamCommand extends Command { - AppRamCommand() { + new() { argParser ..addOption("app") ..addOption( diff --git a/lib/commands/app/restart.dart b/lib/commands/app/restart.dart index cfa8ac6..34dda2d 100644 --- a/lib/commands/app/restart.dart +++ b/lib/commands/app/restart.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class AppRestartCommand extends Command { - AppRestartCommand() { + new() { argParser.addOption("app", valueHelp: "all"); } diff --git a/lib/commands/app/start.dart b/lib/commands/app/start.dart index 4e8df33..9fd5413 100644 --- a/lib/commands/app/start.dart +++ b/lib/commands/app/start.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class AppStartCommand extends Command { - AppStartCommand() { + new() { argParser.addOption("app", valueHelp: "all"); } diff --git a/lib/commands/app/status.dart b/lib/commands/app/status.dart index c9d02d9..7cec1a3 100644 --- a/lib/commands/app/status.dart +++ b/lib/commands/app/status.dart @@ -8,7 +8,7 @@ import "package:discloud/utils/messages.dart"; const _keysToIgnore = {"netIO"}; final class AppStatusCommand extends Command { - AppStatusCommand() { + new() { argParser.addOption("app"); } diff --git a/lib/commands/app/stop.dart b/lib/commands/app/stop.dart index 4cbb365..179c973 100644 --- a/lib/commands/app/stop.dart +++ b/lib/commands/app/stop.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class AppStopCommand extends Command { - AppStopCommand() { + new() { argParser.addOption("app", valueHelp: "all"); } diff --git a/lib/commands/app/upload.dart b/lib/commands/app/upload.dart index a3b73a3..7636dea 100644 --- a/lib/commands/app/upload.dart +++ b/lib/commands/app/upload.dart @@ -13,7 +13,7 @@ import "package:discloud_config/discloud_config.dart"; import "package:path/path.dart" hide context; final class AppUploadCommand extends Command with Disposable { - AppUploadCommand() { + new() { argParser.addMultiOption("glob", abbr: "g", valueHelp: "**"); } diff --git a/lib/commands/domain.dart b/lib/commands/domain.dart index 77d25e3..5829095 100644 --- a/lib/commands/domain.dart +++ b/lib/commands/domain.dart @@ -6,7 +6,7 @@ import "package:discloud/commands/domain/info.dart"; import "package:discloud/commands/domain/verify.dart"; final class DomainCommand extends Command { - DomainCommand() { + new() { addSubcommand(CustomdomainCreateCommand()); addSubcommand(CustomdomainDeleteCommand()); addSubcommand(CustomdomainEditCommand()); diff --git a/lib/commands/domain/create.dart b/lib/commands/domain/create.dart index 5271711..1677314 100644 --- a/lib/commands/domain/create.dart +++ b/lib/commands/domain/create.dart @@ -6,7 +6,7 @@ import "package:discloud/utils/ascii_table.dart"; import "package:discloud/utils/messages.dart"; final class CustomdomainCreateCommand extends Command { - CustomdomainCreateCommand() { + new() { argParser ..addOption("id", aliases: const ["domain"]) ..addOption("app", aliases: const ["subdomain"]); diff --git a/lib/commands/domain/delete.dart b/lib/commands/domain/delete.dart index a52d709..3a0aa2a 100644 --- a/lib/commands/domain/delete.dart +++ b/lib/commands/domain/delete.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class CustomdomainDeleteCommand extends Command { - CustomdomainDeleteCommand() { + new() { argParser.addOption("id", aliases: const ["domain"]); } diff --git a/lib/commands/domain/edit.dart b/lib/commands/domain/edit.dart index 8ae36dd..c9e3047 100644 --- a/lib/commands/domain/edit.dart +++ b/lib/commands/domain/edit.dart @@ -6,7 +6,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class CustomdomainEditCommand extends Command with Disposable { - CustomdomainEditCommand() { + new() { argParser ..addOption("id", aliases: const ["domain"]) ..addOption("app", aliases: const ["subdomain"]); diff --git a/lib/commands/domain/info.dart b/lib/commands/domain/info.dart index d16fcd4..a876e38 100644 --- a/lib/commands/domain/info.dart +++ b/lib/commands/domain/info.dart @@ -6,7 +6,7 @@ import "package:discloud/utils/ascii_table.dart"; import "package:discloud/utils/messages.dart"; final class CustomdomainInfoCommand extends Command { - CustomdomainInfoCommand() { + new() { argParser.addOption("id", aliases: const ["domain"], valueHelp: "all"); } diff --git a/lib/commands/domain/verify.dart b/lib/commands/domain/verify.dart index bbf6b4e..5a3c142 100644 --- a/lib/commands/domain/verify.dart +++ b/lib/commands/domain/verify.dart @@ -6,7 +6,7 @@ import "package:discloud/utils/ascii_table.dart"; import "package:discloud/utils/messages.dart"; final class CustomdomainVerifyCommand extends Command { - CustomdomainVerifyCommand() { + new() { argParser.addOption("id", aliases: const ["domain"]); } diff --git a/lib/commands/init.dart b/lib/commands/init.dart index d40ed2a..3a3b3fa 100644 --- a/lib/commands/init.dart +++ b/lib/commands/init.dart @@ -8,12 +8,11 @@ import "package:discloud/services/discloud/constants.dart"; import "package:discloud_config/discloud_config.dart"; final class InitCommand extends Command { - InitCommand() { + new() { argParser ..addFlag( "autorestart", - help: - "Determines whether the app should automatically restart if it crashes.", + help: "Determines whether the app should automatically restart if it crashes.", negatable: false, ) ..addFlag( @@ -76,7 +75,7 @@ final class InitCommand extends Command { } class _InitArgs { - const _InitArgs(this._argResults); + const new(this._argResults); final ArgResults? _argResults; diff --git a/lib/commands/snapshot.dart b/lib/commands/snapshot.dart index 345bf3e..24aa82f 100644 --- a/lib/commands/snapshot.dart +++ b/lib/commands/snapshot.dart @@ -4,7 +4,7 @@ import "package:discloud/commands/snapshot/download.dart"; import "package:discloud/commands/snapshot/info.dart"; final class SnapshotCommand extends Command { - SnapshotCommand() { + new() { addSubcommand(SnapshotCreateCommand()); addSubcommand(SnapshotDownloadCommand()); addSubcommand(SnapshotInfoCommand()); diff --git a/lib/commands/snapshot/create.dart b/lib/commands/snapshot/create.dart index 90ac069..5aa11b5 100644 --- a/lib/commands/snapshot/create.dart +++ b/lib/commands/snapshot/create.dart @@ -6,7 +6,7 @@ import "package:discloud/utils/ascii_table.dart"; import "package:discloud/utils/messages.dart"; final class SnapshotCreateCommand extends Command { - SnapshotCreateCommand() { + new() { argParser.addOption("app"); } diff --git a/lib/commands/snapshot/download.dart b/lib/commands/snapshot/download.dart index d5cb18d..1dfd044 100644 --- a/lib/commands/snapshot/download.dart +++ b/lib/commands/snapshot/download.dart @@ -13,7 +13,7 @@ import "package:discloud/utils/speed_monitor.dart"; import "package:path/path.dart" hide context; final class SnapshotDownloadCommand extends Command with Disposable { - SnapshotDownloadCommand() { + new() { argParser ..addOption("app") ..addOption("version", help: "Snapshot version in YYYYMMDD-HHMMSS format") @@ -21,8 +21,7 @@ final class SnapshotDownloadCommand extends Command with Disposable { "dir", abbr: "d", aliases: const ["out"], - help: - "Specifies the destination path for downloading backups. The destination path will be considered a directory.", + help: "Specifies the destination path for downloading backups. The destination path will be considered a directory.", ); } diff --git a/lib/commands/snapshot/info.dart b/lib/commands/snapshot/info.dart index ee6bf8c..4a2bea4 100644 --- a/lib/commands/snapshot/info.dart +++ b/lib/commands/snapshot/info.dart @@ -6,7 +6,7 @@ import "package:discloud/utils/ascii_table.dart"; import "package:discloud/utils/messages.dart"; final class SnapshotInfoCommand extends Command { - SnapshotInfoCommand() { + new() { argParser ..addOption("app") ..addOption( diff --git a/lib/commands/subdomain.dart b/lib/commands/subdomain.dart index 1340c67..60a646b 100644 --- a/lib/commands/subdomain.dart +++ b/lib/commands/subdomain.dart @@ -4,7 +4,7 @@ import "package:discloud/commands/subdomain/delete.dart"; import "package:discloud/commands/subdomain/info.dart"; final class SubdomainCommand extends Command { - SubdomainCommand() { + new() { addSubcommand(SubdomainCreateCommand()); addSubcommand(SubdomainDeleteCommand()); addSubcommand(SubdomainInfoCommand()); diff --git a/lib/commands/subdomain/create.dart b/lib/commands/subdomain/create.dart index a0a3260..d8d59ab 100644 --- a/lib/commands/subdomain/create.dart +++ b/lib/commands/subdomain/create.dart @@ -6,7 +6,7 @@ import "package:discloud/utils/ascii_table.dart"; import "package:discloud/utils/messages.dart"; final class SubdomainCreateCommand extends Command { - SubdomainCreateCommand() { + new() { argParser.addOption("id", aliases: const ["subdomain"]); } diff --git a/lib/commands/subdomain/delete.dart b/lib/commands/subdomain/delete.dart index 85dec9d..0d50308 100644 --- a/lib/commands/subdomain/delete.dart +++ b/lib/commands/subdomain/delete.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class SubdomainDeleteCommand extends Command { - SubdomainDeleteCommand() { + new() { argParser.addOption("id", aliases: const ["subdomain"]); } diff --git a/lib/commands/subdomain/info.dart b/lib/commands/subdomain/info.dart index d4e76fe..ac9dd9f 100644 --- a/lib/commands/subdomain/info.dart +++ b/lib/commands/subdomain/info.dart @@ -6,7 +6,7 @@ import "package:discloud/utils/ascii_table.dart"; import "package:discloud/utils/messages.dart"; final class SubdomainInfoCommand extends Command { - SubdomainInfoCommand() { + new() { argParser.addOption("id", aliases: const ["subdomain"], valueHelp: "all"); } diff --git a/lib/commands/system.dart b/lib/commands/system.dart index 8b91153..e2c6658 100644 --- a/lib/commands/system.dart +++ b/lib/commands/system.dart @@ -2,7 +2,7 @@ import "package:args/command_runner.dart"; import "package:discloud/commands/system/locale.dart"; final class SystemCommand extends Command { - SystemCommand() { + new() { addSubcommand(SystemLocaleCommand()); } diff --git a/lib/commands/system/locale.dart b/lib/commands/system/locale.dart index 7a10d86..bc039a1 100644 --- a/lib/commands/system/locale.dart +++ b/lib/commands/system/locale.dart @@ -6,7 +6,7 @@ import "package:discloud/extensions/command.dart"; import "package:intl/intl.dart"; final class SystemLocaleCommand extends Command { - SystemLocaleCommand(); + new(); @override final name = "locale"; diff --git a/lib/commands/team.dart b/lib/commands/team.dart index f3cbd5a..854c0d4 100644 --- a/lib/commands/team.dart +++ b/lib/commands/team.dart @@ -10,7 +10,7 @@ import "package:discloud/commands/team/status.dart"; import "package:discloud/commands/team/stop.dart"; final class TeamCommand extends Command { - TeamCommand() { + new() { addSubcommand(TeamBackupCommand()); addSubcommand(TeamCommitCommand()); addSubcommand(TeamInfoCommand()); diff --git a/lib/commands/team/backup.dart b/lib/commands/team/backup.dart index 1037e04..1454a17 100644 --- a/lib/commands/team/backup.dart +++ b/lib/commands/team/backup.dart @@ -13,15 +13,14 @@ import "package:discloud/utils/speed_monitor.dart"; import "package:path/path.dart" hide context; final class TeamBackupCommand extends Command with Disposable { - TeamBackupCommand() { + new() { argParser ..addOption("app", valueHelp: "all") ..addOption( "dir", abbr: "d", aliases: const ["out", "path"], - help: - "Specifies the destination path for downloading backups. The destination path will be considered a directory.", + help: "Specifies the destination path for downloading backups. The destination path will be considered a directory.", ); } diff --git a/lib/commands/team/commit.dart b/lib/commands/team/commit.dart index 2ea01a2..e6dfca1 100644 --- a/lib/commands/team/commit.dart +++ b/lib/commands/team/commit.dart @@ -14,7 +14,7 @@ import "package:discloud_config/discloud_config.dart"; import "package:path/path.dart" hide context; final class TeamCommitCommand extends Command with Disposable { - TeamCommitCommand() { + new() { argParser ..addOption( "app", diff --git a/lib/commands/team/info.dart b/lib/commands/team/info.dart index 7364f3c..4b84e7b 100644 --- a/lib/commands/team/info.dart +++ b/lib/commands/team/info.dart @@ -20,7 +20,7 @@ const _keysIgnore = { }; final class TeamInfoCommand extends Command { - TeamInfoCommand() { + new() { argParser.addOption("app"); } diff --git a/lib/commands/team/logs.dart b/lib/commands/team/logs.dart index d895010..522134a 100644 --- a/lib/commands/team/logs.dart +++ b/lib/commands/team/logs.dart @@ -9,19 +9,17 @@ import "package:discloud/utils/messages.dart"; import "package:path/path.dart" hide context; final class TeamLogsCommand extends Command { - TeamLogsCommand() { + new() { argParser ..addOption( "app", valueHelp: "all", - help: - "When set to 'all', this command will automatically download logs and will not display URLs. If the 'out' option is not set, downloads will be made to the current folder.", + help: "When set to 'all', this command will automatically download logs and will not display URLs. If the 'out' option is not set, downloads will be made to the current folder.", ) ..addOption( "out", aliases: const ["path"], - help: - "Specifies the destination path for downloading logs. When the application option is set to 'all', the destination path will be considered a directory where all downloads will be stored.", + help: "Specifies the destination path for downloading logs. When the application option is set to 'all', the destination path will be considered a directory where all downloads will be stored.", ); } diff --git a/lib/commands/team/ram.dart b/lib/commands/team/ram.dart index 2f49c31..c43b512 100644 --- a/lib/commands/team/ram.dart +++ b/lib/commands/team/ram.dart @@ -7,7 +7,7 @@ import "package:discloud/utils/messages.dart"; import "package:discloud_config/discloud_config.dart"; final class TeamRamCommand extends Command { - TeamRamCommand() { + new() { argParser ..addOption("app") ..addOption( diff --git a/lib/commands/team/restart.dart b/lib/commands/team/restart.dart index 8b8acfc..3de13fb 100644 --- a/lib/commands/team/restart.dart +++ b/lib/commands/team/restart.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class TeamRestartCommand extends Command { - TeamRestartCommand() { + new() { argParser.addOption("app", valueHelp: "all"); } diff --git a/lib/commands/team/start.dart b/lib/commands/team/start.dart index 5966ad2..37e7b4c 100644 --- a/lib/commands/team/start.dart +++ b/lib/commands/team/start.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class TeamStartCommand extends Command { - TeamStartCommand() { + new() { argParser.addOption("app", valueHelp: "all"); } diff --git a/lib/commands/team/status.dart b/lib/commands/team/status.dart index f8efcd4..31d3225 100644 --- a/lib/commands/team/status.dart +++ b/lib/commands/team/status.dart @@ -8,7 +8,7 @@ import "package:discloud/utils/messages.dart"; const _keysToIgnore = {"netIO"}; final class TeamStatusCommand extends Command { - TeamStatusCommand() { + new() { argParser.addOption("app"); } diff --git a/lib/commands/team/stop.dart b/lib/commands/team/stop.dart index baeb2be..7fc8f4a 100644 --- a/lib/commands/team/stop.dart +++ b/lib/commands/team/stop.dart @@ -5,7 +5,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class TeamStopCommand extends Command { - TeamStopCommand() { + new() { argParser.addOption("app", valueHelp: "all"); } diff --git a/lib/commands/user.dart b/lib/commands/user.dart index 58c17e3..cd584a8 100644 --- a/lib/commands/user.dart +++ b/lib/commands/user.dart @@ -3,7 +3,7 @@ import "package:discloud/commands/user/info.dart"; import "package:discloud/commands/user/locale.dart"; final class UserCommand extends Command { - UserCommand() { + new() { addSubcommand(UserInfoCommand()); addSubcommand(UserLocaleCommand()); } diff --git a/lib/commands/user/locale.dart b/lib/commands/user/locale.dart index a5735f7..c37c258 100644 --- a/lib/commands/user/locale.dart +++ b/lib/commands/user/locale.dart @@ -4,7 +4,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/utils/messages.dart"; final class UserLocaleCommand extends Command { - UserLocaleCommand() { + new() { argParser ..addOption("locale", abbr: "l", mandatory: true, valueHelp: localeName) ..addFlag( diff --git a/lib/commands/wait.dart b/lib/commands/wait.dart index b36e80a..bb91de6 100644 --- a/lib/commands/wait.dart +++ b/lib/commands/wait.dart @@ -6,7 +6,7 @@ import "package:discloud/extensions/command.dart"; import "package:discloud/extensions/num.dart"; final class WaitCommand extends Command with Disposable { - WaitCommand(); + new(); @override final name = "wait"; diff --git a/lib/commands/zip.dart b/lib/commands/zip.dart index 52a9a77..047a61b 100644 --- a/lib/commands/zip.dart +++ b/lib/commands/zip.dart @@ -11,7 +11,7 @@ import "package:discloud/utils/zip.dart"; import "package:path/path.dart" hide context; final class ZipCommand extends Command with Disposable { - ZipCommand() { + new() { argParser ..addOption("encoding", abbr: "e", allowed: const ["buffer"], hide: true) ..addMultiOption("glob", abbr: "g", valueHelp: "**") diff --git a/lib/services/discloud/api_client.dart b/lib/services/discloud/api_client.dart index 9f7bb3b..6638b6c 100644 --- a/lib/services/discloud/api_client.dart +++ b/lib/services/discloud/api_client.dart @@ -60,10 +60,10 @@ class DiscloudApiClient implements Disposable { return null; } - factory DiscloudApiClient({HttpClient? client}) => + factory({HttpClient? client}) => DiscloudApiClient._(client: client ?? .new()); - const DiscloudApiClient._({required this._client}); + const new _({required this._client}); final HttpClient _client; diff --git a/lib/services/discloud/exception.dart b/lib/services/discloud/exception.dart index d71106a..6a6a9e3 100644 --- a/lib/services/discloud/exception.dart +++ b/lib/services/discloud/exception.dart @@ -6,12 +6,12 @@ part "exception.freezed.dart"; abstract interface class DiscloudApiException with _$DiscloudApiException implements Exception { - const factory DiscloudApiException({ - @Default(500) final int code, - @Default("Unknown") final String message, - @Default("/") final String path, - final Map? body, - final String? logs, - final List? localeList, + const factory({ + @Default(500) int code, + @Default("Unknown") String message, + @Default("/") String path, + Map? body, + String? logs, + List? localeList, }) = _DiscloudApiException; } diff --git a/lib/services/discloud/exception.freezed.dart b/lib/services/discloud/exception.freezed.dart index 48d5112..2bf1ad5 100644 --- a/lib/services/discloud/exception.freezed.dart +++ b/lib/services/discloud/exception.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'exception.dart'; @@ -9,12 +9,13 @@ part of 'exception.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; /// @nodoc mixin _$DiscloudApiException { - int get code; String get message; String get path; Map? get body; String? get logs; List? get localeList; + int get code; String get message; String get path; Map? get body; String? get logs; List? get localeList; /// Create a copy of DiscloudApiException /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -45,7 +46,7 @@ abstract mixin class $DiscloudApiExceptionCopyWith<$Res> { factory $DiscloudApiExceptionCopyWith(DiscloudApiException value, $Res Function(DiscloudApiException) _then) = _$DiscloudApiExceptionCopyWithImpl; @useResult $Res call({ - int code, String message, String path, Map? body, String? logs, List? localeList + int code, String message, String path, Map? body, String? logs, List? localeList }); @@ -63,12 +64,12 @@ class _$DiscloudApiExceptionCopyWithImpl<$Res> /// Create a copy of DiscloudApiException /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? code = null,Object? message = null,Object? path = null,Object? body = freezed,Object? logs = freezed,Object? localeList = freezed,}) { - return _then(_self.copyWith( + return _then(DiscloudApiException( code: null == code ? _self.code : code // ignore: cast_nullable_to_non_nullable as int,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable as String,path: null == path ? _self.path : path // ignore: cast_nullable_to_non_nullable as String,body: freezed == body ? _self.body : body // ignore: cast_nullable_to_non_nullable -as Map?,logs: freezed == logs ? _self.logs : logs // ignore: cast_nullable_to_non_nullable +as Map?,logs: freezed == logs ? _self.logs : logs // ignore: cast_nullable_to_non_nullable as String?,localeList: freezed == localeList ? _self.localeList : localeList // ignore: cast_nullable_to_non_nullable as List?, )); @@ -155,7 +156,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( int code, String message, String path, Map? body, String? logs, List? localeList)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( int code, String message, String path, Map? body, String? logs, List? localeList)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _DiscloudApiException() when $default != null: return $default(_that.code,_that.message,_that.path,_that.body,_that.logs,_that.localeList);case _: @@ -176,7 +177,7 @@ return $default(_that.code,_that.message,_that.path,_that.body,_that.logs,_that. /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( int code, String message, String path, Map? body, String? logs, List? localeList) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( int code, String message, String path, Map? body, String? logs, List? localeList) $default,) {final _that = this; switch (_that) { case _DiscloudApiException(): return $default(_that.code,_that.message,_that.path,_that.body,_that.logs,_that.localeList);case _: @@ -196,7 +197,7 @@ return $default(_that.code,_that.message,_that.path,_that.body,_that.logs,_that. /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( int code, String message, String path, Map? body, String? logs, List? localeList)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int code, String message, String path, Map? body, String? logs, List? localeList)? $default,) {final _that = this; switch (_that) { case _DiscloudApiException() when $default != null: return $default(_that.code,_that.message,_that.path,_that.body,_that.logs,_that.localeList);case _: @@ -211,14 +212,14 @@ return $default(_that.code,_that.message,_that.path,_that.body,_that.logs,_that. class _DiscloudApiException implements DiscloudApiException { - const _DiscloudApiException({this.code = 500, this.message = "Unknown", this.path = "/", final Map? body, this.logs, final List? localeList}): _body = body,_localeList = localeList; + const _DiscloudApiException({this.code = 500, this.message = "Unknown", this.path = "/", Map? body, this.logs, List? localeList}): _body = body,_localeList = localeList; @override@JsonKey() final int code; @override@JsonKey() final String message; @override@JsonKey() final String path; - final Map? _body; -@override Map? get body { + final Map? _body; +@override Map? get body { final value = _body; if (value == null) return null; if (_body is EqualUnmodifiableMapView) return _body; @@ -267,7 +268,7 @@ abstract mixin class _$DiscloudApiExceptionCopyWith<$Res> implements $DiscloudAp factory _$DiscloudApiExceptionCopyWith(_DiscloudApiException value, $Res Function(_DiscloudApiException) _then) = __$DiscloudApiExceptionCopyWithImpl; @override @useResult $Res call({ - int code, String message, String path, Map? body, String? logs, List? localeList + int code, String message, String path, Map? body, String? logs, List? localeList }); @@ -290,7 +291,7 @@ code: null == code ? _self.code : code // ignore: cast_nullable_to_non_nullable as int,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable as String,path: null == path ? _self.path : path // ignore: cast_nullable_to_non_nullable as String,body: freezed == body ? _self._body : body // ignore: cast_nullable_to_non_nullable -as Map?,logs: freezed == logs ? _self.logs : logs // ignore: cast_nullable_to_non_nullable +as Map?,logs: freezed == logs ? _self.logs : logs // ignore: cast_nullable_to_non_nullable as String?,localeList: freezed == localeList ? _self._localeList : localeList // ignore: cast_nullable_to_non_nullable as List?, )); diff --git a/lib/services/discloud/user_agent.dart b/lib/services/discloud/user_agent.dart index c10a2bd..a21b51f 100644 --- a/lib/services/discloud/user_agent.dart +++ b/lib/services/discloud/user_agent.dart @@ -5,7 +5,7 @@ import "package:discloud/version.dart"; class UserAgent { static const _product = "DiscloudCLI"; - const UserAgent(); + const new(); String get _version => packageVersion; diff --git a/lib/utils/bytes.dart b/lib/utils/bytes.dart index b467e10..2099e71 100644 --- a/lib/utils/bytes.dart +++ b/lib/utils/bytes.dart @@ -13,19 +13,19 @@ enum Dimension { /// KB = 1000 B decimal(1000); - const Dimension(this.value); + new(this.value); final int value; } class Bytes { - const factory Bytes.bits( + const factory bits( N n, { Dimension dimension, NumberFormat? numberFormatter, }) = _Bits; - const Bytes(this.n, {this.dimension = .binary, this.numberFormatter}); + const new(this.n, {this.dimension = .binary, this.numberFormatter}); final N n; final Dimension dimension; @@ -159,7 +159,7 @@ class Bytes { } class _Bits extends Bytes { - const _Bits(super.n, {super.dimension = .binary, super.numberFormatter}); + const new(super.n, {super.dimension = .binary, super.numberFormatter}); @override UnitType get type => .bit; @@ -298,7 +298,7 @@ enum UnitType { bit(_BitUnit.values), byte(_ByteUnit.values); - const UnitType(this.units); + new(this.units); final List units; } diff --git a/lib/utils/messages.dart b/lib/utils/messages.dart index 270239d..8967514 100644 --- a/lib/utils/messages.dart +++ b/lib/utils/messages.dart @@ -4,9 +4,8 @@ import "package:discloud/services/discloud/exception.dart"; String resolveResponseMessage(T response) { switch (response) { case final Map r: - final StringBuffer buffer = .new(); - - buffer.writeAllCapitalized([?r["status"], ?r["message"]], ": "); + final StringBuffer buffer = .new() + ..writeAllCapitalized([?r["status"], ?r["message"]], ": "); if (r["logs"] case final String logs? when logs.isNotEmpty) { if (buffer.isNotEmpty) buffer.write("\n"); diff --git a/lib/utils/progress.dart b/lib/utils/progress.dart index c2a3f2f..6ac30ad 100644 --- a/lib/utils/progress.dart +++ b/lib/utils/progress.dart @@ -7,7 +7,7 @@ enum UnitDirection { down("↓"), both("⇅"); - const UnitDirection(this.symbol); + new(this.symbol); final String symbol; diff --git a/lib/utils/signal_wrapper.dart b/lib/utils/signal_wrapper.dart index dd73941..eee3055 100644 --- a/lib/utils/signal_wrapper.dart +++ b/lib/utils/signal_wrapper.dart @@ -6,10 +6,10 @@ import "package:discloud/extensions/list.dart"; typedef OnDisposeCallback = FutureOr Function(); typedef OnSignalCallback = FutureOr Function(ProcessSignal signal); -final class _Cancelled implements Exception {} +final class _Cancelled implements Exception; abstract class SignalWrapper { - factory SignalWrapper.multi( + factory multi( Iterable signals, { OnDisposeCallback? onDispose, OnSignalCallback? onSignal, @@ -20,7 +20,7 @@ abstract class SignalWrapper { completer: .new(), ); - factory SignalWrapper( + factory( ProcessSignal signal, { OnSignalCallback? onSignal, OnDisposeCallback? onDispose, @@ -40,7 +40,7 @@ abstract class SignalWrapper { } class _MultiSignalWrapper implements SignalWrapper { - const _MultiSignalWrapper( + const new( this._signals, { required this._completer, this.onSignal, @@ -85,7 +85,7 @@ class _MultiSignalWrapper implements SignalWrapper { } class _SingleSignalWrapper implements SignalWrapper { - const _SingleSignalWrapper( + const new( this._signal, { required this._completer, this.onDispose, diff --git a/lib/utils/speed_monitor.dart b/lib/utils/speed_monitor.dart index 053bd06..e1d50e3 100644 --- a/lib/utils/speed_monitor.dart +++ b/lib/utils/speed_monitor.dart @@ -3,7 +3,7 @@ import "dart:collection"; import "package:discloud/cli/disposable.dart"; final class _SpeedSample extends LinkedListEntry<_SpeedSample> { - _SpeedSample(this.units) : time = DateTime.now().microsecondsSinceEpoch; + new(this.units) : time = DateTime.now().microsecondsSinceEpoch; final int time; final int units; @@ -14,9 +14,9 @@ class SpeedMonitor implements Disposable { static const double _zero = 0; /// Creates a [SpeedMonitor] - factory SpeedMonitor() => ._(queue: .new()); + factory() => ._(queue: .new()); - const SpeedMonitor._({ + const new _({ required this._queue, this._windowDuration = const .new(seconds: 1), }); diff --git a/modules/glob_zipper/lib/src/exception.dart b/modules/glob_zipper/lib/src/exception.dart index 54657de..5207e95 100644 --- a/modules/glob_zipper/lib/src/exception.dart +++ b/modules/glob_zipper/lib/src/exception.dart @@ -1,5 +1,5 @@ part of "glob_zipper.dart"; class ZipException implements Exception { - const ZipException(); + const new(); } diff --git a/modules/glob_zipper/lib/src/fs.dart b/modules/glob_zipper/lib/src/fs.dart index ec71969..a3fecbf 100644 --- a/modules/glob_zipper/lib/src/fs.dart +++ b/modules/glob_zipper/lib/src/fs.dart @@ -13,14 +13,13 @@ class FS { return path.replaceAll(_rSlash, _pSep); } - FS({ + new({ required this.directory, this.globPatterns = const ["**"], this.ignoreFilename, Iterable ignorePatterns = const .empty(), - }) : _originalIgnorePatterns = _transformIterableToGlob( - ignorePatterns, - ).toSet(), + }) : _originalIgnorePatterns = _transformIterableToGlob(ignorePatterns) + .toSet(), _ignorePatterns = .new(); final Directory directory; diff --git a/modules/glob_zipper/lib/src/glob_zipper.dart b/modules/glob_zipper/lib/src/glob_zipper.dart index 9d721e6..7cd8f67 100644 --- a/modules/glob_zipper/lib/src/glob_zipper.dart +++ b/modules/glob_zipper/lib/src/glob_zipper.dart @@ -44,7 +44,7 @@ class GlobZipper { onError: onError, ); - const GlobZipper({ + const new({ required this.directory, required this.zipfile, this.globPatterns = const ["**"], diff --git a/modules/glob_zipper/lib/src/zip_progress.dart b/modules/glob_zipper/lib/src/zip_progress.dart index 9e8710a..4015fd3 100644 --- a/modules/glob_zipper/lib/src/zip_progress.dart +++ b/modules/glob_zipper/lib/src/zip_progress.dart @@ -1,7 +1,7 @@ part of "glob_zipper.dart"; class ZipProgress { - const ZipProgress({ + const new({ required this.file, required this.stat, required this.current, diff --git a/modules/glob_zipper/pubspec.yaml b/modules/glob_zipper/pubspec.yaml index 6525d43..7a7d834 100644 --- a/modules/glob_zipper/pubspec.yaml +++ b/modules/glob_zipper/pubspec.yaml @@ -3,7 +3,7 @@ description: A starting point for Dart libraries or applications. version: 1.0.0 environment: - sdk: ^3.12.2 + sdk: ^3.13.1 dependencies: archive: any diff --git a/modules/interact/lib/src/confirm.dart b/modules/interact/lib/src/confirm.dart index 2c13fbb..83f78e9 100644 --- a/modules/interact/lib/src/confirm.dart +++ b/modules/interact/lib/src/confirm.dart @@ -5,14 +5,11 @@ import "package:interact/src/utils/prompt.dart"; /// A confirm component. class Confirm extends Component { /// Constructs a [Confirm] component with the default theme. - Confirm({ - required this.prompt, - this.defaultValue, - this.waitForNewLine = false, - }) : theme = Theme.defaultTheme; + new({required this.prompt, this.defaultValue, this.waitForNewLine = false}) + : theme = Theme.defaultTheme; /// Constructs a [Confirm] component with the supplied theme. - Confirm.withTheme({ + new withTheme({ required this.theme, required this.prompt, this.defaultValue, diff --git a/modules/interact/lib/src/framework/context.dart b/modules/interact/lib/src/framework/context.dart index 845f5ac..bdc5131 100644 --- a/modules/interact/lib/src/framework/context.dart +++ b/modules/interact/lib/src/framework/context.dart @@ -203,7 +203,7 @@ class Context { /// containing multiple [BufferContext]s to the console. class BufferContext extends Context { /// Constructs a [BufferContext] with given properties. - BufferContext({required this.buffer, required this.setState}); + new({required this.buffer, required this.setState}); /// Buffer stores the lines written to the context. final StringBuffer buffer; diff --git a/modules/interact/lib/src/input.dart b/modules/interact/lib/src/input.dart index 018d613..b6c118c 100644 --- a/modules/interact/lib/src/input.dart +++ b/modules/interact/lib/src/input.dart @@ -6,7 +6,7 @@ import "package:interact/src/utils/prompt.dart"; /// validator when there is an error. class ValidationError { /// Constructs a [ValidationError] with given message. - ValidationError(this.message); + new(this.message); /// The error message. final String message; @@ -15,7 +15,7 @@ class ValidationError { /// An input component. class Input extends Component { /// Constructs an [Input] component with the default theme. - Input({ + new({ required this.prompt, this.validator, this.initialText = "", @@ -23,7 +23,7 @@ class Input extends Component { }) : theme = Theme.defaultTheme; /// Constructs an [Input] component with the supplied theme. - Input.withTheme({ + new withTheme({ required this.prompt, required this.theme, this.validator, diff --git a/modules/interact/lib/src/integer.dart b/modules/interact/lib/src/integer.dart index 1d5e044..54a92e1 100644 --- a/modules/interact/lib/src/integer.dart +++ b/modules/interact/lib/src/integer.dart @@ -8,7 +8,7 @@ const _numbers = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}; const _signSymbol = "-"; class Integer extends Component { - Integer({required this.prompt, this.max, this.min}) + new({required this.prompt, this.max, this.min}) : assert(max == null || min == null || min <= max), theme = Theme.defaultTheme; diff --git a/modules/interact/lib/src/multi_select.dart b/modules/interact/lib/src/multi_select.dart index 85b29c5..61ed800 100644 --- a/modules/interact/lib/src/multi_select.dart +++ b/modules/interact/lib/src/multi_select.dart @@ -5,11 +5,11 @@ import "package:interact/src/utils/prompt.dart"; /// A multiple select or checkbox input component. class MultiSelect extends Component> { /// Constructs a [MultiSelect] component with the default theme. - MultiSelect({required this.prompt, required this.options, this.defaults}) + new({required this.prompt, required this.options, this.defaults}) : theme = Theme.defaultTheme; /// Constructs a [MultiSelect] component with the supplied theme. - MultiSelect.withTheme({ + new withTheme({ required this.prompt, required this.options, required this.theme, diff --git a/modules/interact/lib/src/password.dart b/modules/interact/lib/src/password.dart index e55de95..1d86616 100644 --- a/modules/interact/lib/src/password.dart +++ b/modules/interact/lib/src/password.dart @@ -5,7 +5,7 @@ import "package:interact/src/utils/prompt.dart"; /// A password input component. class Password extends Component { /// Constructs a [Password] component with the default theme. - Password({ + new({ required this.prompt, this.confirmation = false, this.confirmPrompt, @@ -13,7 +13,7 @@ class Password extends Component { }) : theme = Theme.defaultTheme; /// Constructs a [Password] component with the supplied theme. - Password.withTheme({ + new withTheme({ required this.theme, required this.prompt, this.confirmation = false, diff --git a/modules/interact/lib/src/progress.dart b/modules/interact/lib/src/progress.dart index 59c495c..cd7a933 100644 --- a/modules/interact/lib/src/progress.dart +++ b/modules/interact/lib/src/progress.dart @@ -11,7 +11,7 @@ String _prompt(int x) => ""; /// A progress bar component. class Progress extends Component { /// Constructs a [Progress] component with the default theme. - Progress({ + new({ required this.length, this.size = 1.0, this.leftPrompt = _prompt, @@ -19,7 +19,7 @@ class Progress extends Component { }) : theme = Theme.defaultTheme; /// Constructs a [Progress] component with the supplied theme. - Progress.withTheme({ + new withTheme({ required this.theme, required this.length, this.size = 1.0, @@ -71,7 +71,7 @@ class Progress extends Component { /// Handles a progress bar's state. class ProgressState { /// Constructs a [ProgressState] with it's all properties. - ProgressState({ + new({ required this.current, required this.clear, required this.increase, diff --git a/modules/interact/lib/src/select.dart b/modules/interact/lib/src/select.dart index 2b2d71e..75f6298 100644 --- a/modules/interact/lib/src/select.dart +++ b/modules/interact/lib/src/select.dart @@ -6,11 +6,11 @@ import "package:interact/src/utils/prompt.dart"; /// A selector component. class Select extends Component { /// Constructs a [Select] component with the default theme. - Select({required this.prompt, required this.options, this.initialIndex = 0}) + new({required this.prompt, required this.options, this.initialIndex = 0}) : theme = Theme.defaultTheme; /// Constructs a [Select] component with the supplied theme. - Select.withTheme({ + new withTheme({ required this.prompt, required this.options, required this.theme, diff --git a/modules/interact/lib/src/sort.dart b/modules/interact/lib/src/sort.dart index 7ce07fc..f432872 100644 --- a/modules/interact/lib/src/sort.dart +++ b/modules/interact/lib/src/sort.dart @@ -6,11 +6,11 @@ import "package:interact/src/utils/prompt.dart"; /// A sortable list component. class Sort extends Component> { /// Constructs a [Sort] component with the default theme. - Sort({required this.prompt, required this.options, this.showOutput = true}) + new({required this.prompt, required this.options, this.showOutput = true}) : theme = Theme.defaultTheme; /// Constructs a [Sort] component with the default theme. - Sort.withTheme({ + new withTheme({ required this.prompt, required this.options, required this.theme, diff --git a/modules/interact/lib/src/spinner.dart b/modules/interact/lib/src/spinner.dart index 6840ddc..a454d2c 100644 --- a/modules/interact/lib/src/spinner.dart +++ b/modules/interact/lib/src/spinner.dart @@ -10,14 +10,14 @@ String _prompt(bool x) => ""; /// A spinner or a loading indicator component. class Spinner extends Component { /// Construts a [Spinner] component with the default theme. - Spinner({ + new({ required this.icon, this.leftPrompt = _prompt, this.rightPrompt = _prompt, }) : theme = Theme.defaultTheme; /// Constructs a [Spinner] component with the supplied theme. - Spinner.withTheme({ + new withTheme({ required this.icon, required this.theme, this.leftPrompt = _prompt, @@ -63,7 +63,7 @@ class Spinner extends Component { /// Handles a [Spinner]'s state. class SpinnerState { /// Constructs a state to manage a [Spinner]. - SpinnerState({required this.done}); + new({required this.done}); /// Function to be called to indicate that the /// spinner is loaded. diff --git a/modules/interact/lib/src/theme/theme.dart b/modules/interact/lib/src/theme/theme.dart index 7e2b208..d06c127 100644 --- a/modules/interact/lib/src/theme/theme.dart +++ b/modules/interact/lib/src/theme/theme.dart @@ -13,7 +13,7 @@ typedef StyleFunction = String Function(String); /// The theme to be used by components. class Theme { /// Constructs a new [Theme] with all of it's properties. - const Theme({ + const new({ required this.inputPrefix, required this.inputSuffix, required this.successPrefix, diff --git a/modules/interact/pubspec.yaml b/modules/interact/pubspec.yaml index becec69..2540a03 100644 --- a/modules/interact/pubspec.yaml +++ b/modules/interact/pubspec.yaml @@ -4,7 +4,7 @@ version: 2.2.0 publish_to: none environment: - sdk: ^3.12.2 + sdk: ^3.13.1 dependencies: dart_console: any diff --git a/modules/local_store/lib/src/json_local_store.dart b/modules/local_store/lib/src/json_local_store.dart index 1f1f52e..cdd2775 100644 --- a/modules/local_store/lib/src/json_local_store.dart +++ b/modules/local_store/lib/src/json_local_store.dart @@ -11,7 +11,7 @@ class _JSONLocalStore implements LocalStore { .fuse(base64.encoder) .fuse(utf8.encoder); - _JSONLocalStore(String path) : _cache = .new(), _file = .new(path); + new(String path) : _cache = .new(), _file = .new(path); final Map _cache; final File _file; diff --git a/modules/local_store/lib/src/local_store.dart b/modules/local_store/lib/src/local_store.dart index 1fda816..4d6dede 100644 --- a/modules/local_store/lib/src/local_store.dart +++ b/modules/local_store/lib/src/local_store.dart @@ -7,7 +7,7 @@ import "package:nested_map/nested_map.dart"; part "json_local_store.dart"; abstract class LocalStore { - factory LocalStore.json(String path) = _JSONLocalStore; + factory json(String path) = _JSONLocalStore; Future get(String key); Stream getMany(Iterable keys); diff --git a/modules/local_store/pubspec.yaml b/modules/local_store/pubspec.yaml index 0961676..7f856c1 100644 --- a/modules/local_store/pubspec.yaml +++ b/modules/local_store/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.12.2 + sdk: ^3.13.1 dependencies: nested_map: diff --git a/modules/nested_map/pubspec.yaml b/modules/nested_map/pubspec.yaml index 6b3f58d..1a63282 100644 --- a/modules/nested_map/pubspec.yaml +++ b/modules/nested_map/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.12.2 + sdk: ^3.13.1 dev_dependencies: lints: any diff --git a/pubspec.yaml b/pubspec.yaml index 42a1a15..6c2b340 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none repository: https://github.com/discloud/cli-dart environment: - sdk: ^3.12.2 + sdk: ^3.13.1 dependencies: glob_zipper: @@ -31,14 +31,14 @@ dependencies: tint: ^2.0.1 dev_dependencies: - build_runner: ^2.15.1 + build_runner: ^2.16.0 build_version: ^2.1.3 - freezed: ^3.2.5 - inno_bundle: ^0.11.2 + freezed: ^4.0.0 + inno_bundle: ^0.12.0 interpolation: ^2.1.2 json_serializable: ^6.14.0 lints: ^6.1.0 markdown: ^7.3.1 pub_semver: ^2.2.0 - test: ^1.31.1 + test: ^1.31.2 yaml: ^3.1.3 diff --git a/scripts/docs/generate.dart b/scripts/docs/generate.dart index 388fc11..163c325 100644 --- a/scripts/docs/generate.dart +++ b/scripts/docs/generate.dart @@ -115,10 +115,8 @@ void main() async { } class _LocalLinkMdSyntax extends InlineSyntax { - _LocalLinkMdSyntax({ - required this.relativeRootPath, - required this.localFileList, - }) : super(r"\[([^\]]+)\]\((.+.md)\)"); + new({required this.relativeRootPath, required this.localFileList}) + : super(r"\[([^\]]+)\]\((.+.md)\)"); final String relativeRootPath; final Set localFileList;