Skip to content

Commit

Permalink
remove dep on package:collection
Browse files Browse the repository at this point in the history
  • Loading branch information
devoncarew committed Dec 19, 2017
1 parent 8f19d15 commit 2af3add
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
22 changes: 16 additions & 6 deletions lib/src/task_invocation.dart
Expand Up @@ -3,8 +3,6 @@

library grinder.src.task_invocation;

import 'package:collection/collection.dart';

/// An invocation of a [GrinderTask].
///
/// Identifies the [name] of the task to invoke, and any [arguments] to send to
Expand All @@ -22,11 +20,9 @@ class TaskInvocation {
bool operator ==(other) =>
other is TaskInvocation &&
name == other.name &&
const IterableEquality()
.equals(arguments.arguments, other.arguments.arguments);
_listEquals(arguments.arguments, other.arguments.arguments);

int get hashCode =>
name.hashCode ^ (const IterableEquality().hash(arguments.arguments) * 3);
int get hashCode => name.hashCode ^ (arguments.arguments.length * 3);

String toString() {
var args = arguments.arguments;
Expand Down Expand Up @@ -90,3 +86,17 @@ class TaskArgs {
}
}
}

bool _listEquals(List elements1, List elements2) {
if (identical(elements1, elements2)) return true;
if (elements1 == null || elements2 == null) return false;
if (elements1.length != elements2.length) return false;
var it1 = elements1.iterator;
var it2 = elements2.iterator;
while (true) {
bool hasNext = it1.moveNext();
if (hasNext != it2.moveNext()) return false;
if (!hasNext) return true;
if (it1.current != it2.current) return false;
}
}
1 change: 0 additions & 1 deletion pubspec.yaml
Expand Up @@ -13,7 +13,6 @@ environment:

dependencies:
cli_util: ^0.1.2
collection: '>=1.1.0 <2.0.0'
glob: '>=1.0.0 <2.0.0'
path: '>=1.0.0 <2.0.0'

Expand Down

0 comments on commit 2af3add

Please sign in to comment.