fast_immutable_collections
fast_immutable_collections copied to clipboard
Own iterable Class with FromIterableIListMixin not iterable in Web
Hi,
i created my own iterable class:
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
class MyIter with FromIterableIListMixin<String> implements Iterable<String>{
MyIter([Iterable<String> strings]) : _strings = IList(strings);
final IList<String> _strings;
@override
IList<String> get iter => _strings;
}
if i use this class inside a for loop e.g.:
for (final String letter in _myIter){ string += letter; }
this iterable works well on android emulator but if i use chrome it throws:
"TypeError: this[_myIter] is not iterable"
only if i write:
for (final String letter in _myIter.iter){ string += letter; }
it works. Did i do something wrong or is this a bug?
Strange. I'm not sure what's the culprit from a first look. It might not be anybody's fault though, because transpilation to JS assumes many unexpected limitations. Are you using Flutter or transpiling directly to JS from Dart?
Im using Flutter 2.2.0
Your MyIterclass explicitly implements Iterable, and it says it is not an iterable. It seems like a bug in Dart.
Could you please open a bug report in https://github.com/dart-lang/sdk/issues, post your code there, and link to this page?
Since it seems you have a reproducible code snippet, they can fix it.