shamblett / cbor

A CBOR implementation for Dart
MIT License
36 stars 16 forks source link

Compilation fails using inside flutter #6

Closed ytitov closed 4 years ago

ytitov commented 4 years ago

I am getting the following error when running my app. I included the dart version and flutter version below. Any ideas?

../../../flutter/.pub-cache/hosted/pub.dartlang.org/cbor-2.0.2/lib/src/cbor_item_stack.dart:11:7: Error: Type argument 'LinkedListEntry<dynamic>' doesn't conform to the bound 'LinkedListEntry<E>' of the type variable 'E' on 'LinkedListEntry' in the supertype 'LinkedListEntry' of class 'ItemEntry'.

 - 'LinkedListEntry' is from 'dart:collection'.
Try changing type arguments so that they conform to the bounds.
class ItemEntry<DartItem> extends LinkedListEntry {
      ^

Flutter 1.9.1+hotfix.4 • channel stable • https://github.com/flutter/flutter.git Framework • revision cc949a8e8b (2 weeks ago) • 2019-09-27 15:04:59 -0700 Engine • revision b863200c37 Tools • Dart 2.5.0

ytitov commented 4 years ago

changing

class ItemEntry<DartItem> extends LinkedListEntry {
  DartItem value;

  ItemEntry(this.value);

  String toString() => "${super.toString()} : value.toString()";
}

TO:

class ItemEntry<DartItem> extends LinkedListEntry<ItemEntry> {
  DartItem value;

  ItemEntry(this.value);

  String toString() => "${super.toString()} : value.toString()";
}

made the compiler happy

shamblett commented 4 years ago

Thanks for this fix, package updated and republished at 2.0.3