diff --git a/lib/src/core/array.dart b/lib/src/core/array.dart index 0ca6db22..d7163890 100644 --- a/lib/src/core/array.dart +++ b/lib/src/core/array.dart @@ -1,6 +1,5 @@ import 'dart:ffi' as ffi; -import 'package:equatable/equatable.dart'; import 'package:ffi/ffi.dart'; import 'base.dart'; @@ -8,7 +7,7 @@ import 'base.dart'; // Dart does not support multiple upper bounds for T now, if they implement it, this can be simplified. // https://github.com/dart-lang/language/issues/2709 abstract class NativeArray - with EquatableMixin + with ComparableMixin implements ffi.Finalizable, INativeArray

{ NativeArray([this.length = 0]); diff --git a/lib/src/core/base.dart b/lib/src/core/base.dart index 7e3d9562..b877a0b6 100644 --- a/lib/src/core/base.dart +++ b/lib/src/core/base.dart @@ -55,23 +55,25 @@ final CFFI = cvg.CvNative(loadNativeLibrary()); // base structures abstract class CvObject implements ffi.Finalizable {} -abstract class ICvStruct extends CvObject { - ICvStruct.fromPointer(this.ptr); - - ffi.Pointer ptr; - T get ref; - +mixin ComparableMixin { List get props; @override // ignore: hash_and_equals bool operator ==(Object other) { - if (other is! ICvStruct) return false; + if (other is! ComparableMixin) return false; if (props.length != other.props.length) return false; return props.indexed.every((e) => other.props[e.$1] == e.$2); } } +abstract class ICvStruct extends CvObject with ComparableMixin { + ICvStruct.fromPointer(this.ptr); + + ffi.Pointer ptr; + T get ref; +} + abstract class CvStruct extends ICvStruct { CvStruct.fromPointer(super.ptr) : super.fromPointer(); } diff --git a/lib/src/core/error_code.dart b/lib/src/core/error_code.dart index f5895196..5edc2484 100644 --- a/lib/src/core/error_code.dart +++ b/lib/src/core/error_code.dart @@ -11,9 +11,9 @@ LICENSE: Apache-2.0 */ -import 'package:equatable/equatable.dart'; +import 'base.dart'; -class ErrorCode with EquatableMixin { +class ErrorCode with ComparableMixin { /// @brief everithing is ok CV_StsOk static final ErrorCode StsOk = ErrorCode(0); diff --git a/lib/src/core/mat_type.dart b/lib/src/core/mat_type.dart index 6f65ede2..6fdcf11b 100644 --- a/lib/src/core/mat_type.dart +++ b/lib/src/core/mat_type.dart @@ -2,10 +2,10 @@ library cv; -import 'package:equatable/equatable.dart'; +import 'base.dart'; import 'exception.dart'; -class MatType extends Equatable { +class MatType with ComparableMixin { final int value; const MatType(this.value); diff --git a/lib/src/core/vec.dart b/lib/src/core/vec.dart index d31f0394..800e058e 100644 --- a/lib/src/core/vec.dart +++ b/lib/src/core/vec.dart @@ -4,13 +4,12 @@ import 'dart:convert'; import 'dart:ffi' as ffi; import 'dart:typed_data'; -import 'package:equatable/equatable.dart'; import 'package:ffi/ffi.dart'; import '../opencv.g.dart' as cvg; import 'base.dart'; -abstract class Vec with IterableMixin, EquatableMixin implements ffi.Finalizable { +abstract class Vec with IterableMixin, ComparableMixin implements ffi.Finalizable { @override int get length; diff --git a/pubspec.yaml b/pubspec.yaml index 492b74bc..0cafee4b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,10 +11,10 @@ dependencies: flutter: sdk: flutter plugin_platform_interface: ^2.1.8 - ffi: ^2.1.0 + ffi: ^2.1.2 path: ^1.9.0 args: ^2.5.0 - archive: ^3.5.1 + archive: ^3.6.1 stack_trace: ^1.11.1 dev_dependencies: