Skip to content

Commit

Permalink
upgraded deps include the dcli dev dep to 5.0 to support dart 3.5
Browse files Browse the repository at this point in the history
Fixed new lint issues from upgrade lint_hard.

replaced whereNotNull with nonNulls
  • Loading branch information
bsutton committed Aug 7, 2024
1 parent 5ae3d44 commit d0f8477
Show file tree
Hide file tree
Showing 15 changed files with 311 additions and 302 deletions.
4 changes: 1 addition & 3 deletions lib/src/api/auth_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AuthResponse {

factory AuthResponse.parse(EndpointResponse response) {
final auth = AuthResponse._internal();
if (response.success == true) {
if (response.success) {
auth.status = parseStatus(response.data['status'] as String? ??
AwaitLoginStatus.authFailed.toString());

Expand All @@ -19,10 +19,8 @@ class AuthResponse {
..organisationName = response.data['organisationName']! as String
..obfuscatedOrganisationId =
response.data['obfuscatedOrganisationId']! as String;
break;
case AwaitLoginStatus.retry:
auth.pollInterval = response.data['pollInterval'] as int? ?? 3;
break;
case AwaitLoginStatus.authFailed:
throw ExitException(exitCode: 1, message: 'Authentication failed');
case AwaitLoginStatus.timeout:
Expand Down
5 changes: 2 additions & 3 deletions lib/src/my_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class MyRunner extends CommandRunner<int> implements PubTopLevel {
switch (commandSet) {
case CommandSet.onepub:
onepubCommands(commandSet);
break;
case CommandSet.opub:
opubCommands();
}
Expand All @@ -69,8 +68,8 @@ class MyRunner extends CommandRunner<int> implements PubTopLevel {

await Settings().setVerbose(enabled: results['debug'] as bool);

final version = results['version'] as bool == true;
if (version == true) {
final version = results['version'] as bool;
if (version) {
// no output required as the startup logic already prints the version.
exit(0);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/pub/solver/failure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class _Writer {
// installed, if an SDK is incompatible with a dependency.
final notices = _root.externalIncompatibilities
.map((c) => c.cause.notice)
.whereNotNull()
.nonNulls
.toSet() // Avoid duplicates
.sortedBy((n) => n); // sort for consistency
for (final n in notices) {
Expand Down Expand Up @@ -158,7 +158,7 @@ class _Writer {
// understand how to fix the issue.
_root.externalIncompatibilities
.map((c) => c.cause.hint)
.whereNotNull()
.nonNulls
.toSet() // avoid duplicates
.sortedBy((hint) => hint) // sort hints for consistent ordering.
.forEach((hint) {
Expand Down
3 changes: 1 addition & 2 deletions lib/src/pub/source/git.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import 'dart:async';
import 'dart:io';

import 'package:collection/collection.dart' show IterableNullableExtension;
import 'package:path/path.dart' as p;
import 'package:pool/pool.dart';
import 'package:pub_semver/pub_semver.dart';
Expand Down Expand Up @@ -436,7 +435,7 @@ class GitSource extends CachedSource {
}
});
})
.whereNotNull()
.nonNulls
.toList();

// Note that there may be multiple packages with the same name and version
Expand Down
5 changes: 2 additions & 3 deletions lib/src/pub/source/hosted.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import 'dart:io' as io;
import 'dart:io';
import 'dart:typed_data';

import 'package:collection/collection.dart'
show IterableExtension, IterableNullableExtension, maxBy;
import 'package:collection/collection.dart' show IterableExtension, maxBy;
import 'package:crypto/crypto.dart';
import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
Expand Down Expand Up @@ -1057,7 +1056,7 @@ class HostedSource extends CachedSource {
return null;
}
})
.whereNotNull()
.nonNulls
.toList();
}

Expand Down
5 changes: 2 additions & 3 deletions lib/src/pub/system_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

import 'dart:io';

import 'package:collection/collection.dart';
import 'package:path/path.dart' as p;
import 'package:pub_semver/pub_semver.dart';

import 'authentication/token_store.dart';
import 'exceptions.dart';
import 'io.dart';
import 'io.dart' as io show createTempDir;
import 'io.dart';
import 'log.dart' as log;
import 'package.dart';
import 'package_name.dart';
Expand Down Expand Up @@ -206,7 +205,7 @@ Consider setting the `PUB_CACHE` variable manually.
return null;
}),
))
.whereNotNull()
.nonNulls
.toList();

return versions;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/util/file_sync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class FileSync {
line.write(char);
priorChar = char;
}
final endOfFile = line.isEmpty && foundDelimiter == false;
final endOfFile = line.isEmpty && !foundDelimiter;
return endOfFile ? null : line.toString();
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/util/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void _logout(String message) {
final args = ParsedArgs();

var message0 = message;
if (args.colour == false) {
if (!args.colour) {
message0 = Ansi.strip(message);
}

Expand All @@ -54,7 +54,7 @@ void _logerr(String message) {
final args = ParsedArgs();

var message0 = message;
if (args.colour == false) {
if (!args.colour) {
message0 = Ansi.strip(message);
}

Expand Down
2 changes: 0 additions & 2 deletions lib/src/util/send_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,12 @@ run: onepub login
case Method.get:
request = await client.getUrl(uri);
_addHeaders(headers0, request);
break;
case Method.post:
request = await client.postUrl(uri);
_addHeaders(headers0, request);
if (body != null) {
request.write(body);
}
break;
}

final response = await request.close();
Expand Down
Loading

0 comments on commit d0f8477

Please sign in to comment.