// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'dart:collection'; class ConstIterable extends IterableBase { const ConstIterable(); Iterator get iterator => [].iterator; } class ConstMap implements Map { const ConstMap(); Iterable> get entries => const []; bool get isEmpty => throw UnsupportedError("unsupported"); bool get isNotEmpty => throw UnsupportedError("unsupported"); Iterable get keys => throw UnsupportedError("unsupported"); int get length => throw UnsupportedError("unsupported"); Iterable get values => throw UnsupportedError("unsupported"); String operator [](Object key) => throw UnsupportedError("unsupported"); operator []=(int key, String value) => throw UnsupportedError("unsupported"); bool add(Object value) => throw UnsupportedError("unsupported"); void addAll(Map map) => throw UnsupportedError("unsupported"); void addEntries(Iterable> entries) => throw UnsupportedError("unsupported"); Map cast() => throw UnsupportedError("unsupported"); void clear() => throw UnsupportedError("unsupported"); bool containsKey(Object key) => throw UnsupportedError("unsupported"); bool containsValue(Object value) => throw UnsupportedError("unsupported"); void forEach(void Function(int key, String value) f) => throw UnsupportedError("unsupported"); Map map(MapEntry Function(int key, String value) f) => throw UnsupportedError("unsupported"); String putIfAbsent(int key, String Function() ifAbsent) => throw UnsupportedError("unsupported"); String remove(Object key) => throw UnsupportedError("unsupported"); void removeWhere(bool Function(int key, String value) predicate) => throw UnsupportedError("unsupported"); String update(int key, String Function(String value) update, {String Function() ifAbsent}) => throw UnsupportedError("unsupported"); void updateAll(String Function(int key, String value) update) => throw UnsupportedError("unsupported"); } class CustomMap with MapMixin { Iterable get keys => []; String operator [](Object key) => ""; operator []=(int key, String value) {} String remove(Object key) => throw UnsupportedError("unsupported"); void clear() => throw UnsupportedError("unsupported"); } class CustomSet extends SetBase { bool add(int value) => throw UnsupportedError("unsupported"); bool contains(Object value) => throw UnsupportedError("unsupported"); Iterator get iterator => [].iterator; int get length => 0; int lookup(Object value) => throw UnsupportedError("unsupported"); bool remove(Object value) => throw UnsupportedError("unsupported"); Set toSet() => this; } class Equality { final int id; final String name; const Equality(this.id, this.name); int get hashCode => id; bool operator ==(Object other) => other is Equality && id == other.id; String toString() => "$id:$name"; }