Josh
Josh

Reputation: 11

What is _CompactLinkedHashSet in flutter?

I am trying to run my first flutter app and I am getting a redscreen error when I run it on my iPhone but it runs without a problem on the simulator:

type '_CompactLinkedHashSet' is not a subtype of type 'Widget'.

Does anyone know what this error refers to? The error-causing widget is a FutureBuilder. The type of the FutureBuilder is the same as the Future.

Flutter doctor:

[✓] Flutter (Channel dev, v1.18.0, on Mac OS X 10.15.4 19E287, locale en-AU) • Flutter version 1.18.0 at /Users/Josh/Developer/flutter • Framework revision 8f7327f83a (11 days ago), 2020-04-06 22:11:01 -0400 • Engine revision 49891e0653 • Dart version 2.8.0 (build 2.8.0-dev.20.0 1210d27678)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /Users/Josh/Library/Android/sdk • Platform android-29, build-tools 29.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.4.1, Build version 11E503a • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] Connected device ! No devices available

! Doctor found issues in 1 category.

class DisclaimerData {
  bool agreed;
  String version;
  DisclaimerData({this.agreed, this.version});
}


class DisclaimerView extends StatefulWidget {
  @override
  _DisclaimerViewState createState() => _DisclaimerViewState();
}

class _DisclaimerViewState extends State<DisclaimerView> {

Future<DisclaimerData> _getAgreed() async {
    final preferences = await SharedPreferences.getInstance();
    final disclaimerValues = DisclaimerData();

      disclaimerValues.agreed = preferences.getBool('disclaimer_agreed') ?? false;
      disclaimerValues.version =
    preferences.getString('disclaimer_version') ?? '0';

    return disclaimerValues;
  }

@override     
Widget build(BuildContext context) {
   return FutureBuilder<DisclaimerData>(
      future: _getAgreed(),
      builder: (context, snapshot) {
        if (snapshot.hasData) {
          return Scaffold(
...

Upvotes: 1

Views: 2574

Answers (1)

Konstantin Kozirev
Konstantin Kozirev

Reputation: 1262

_CompactLinkedHashSet is an alternative name for Set. It is internal default Set implementation that dart uses to optimize Set's data structure.

_CompactLinkedHashSet (default Set implementation) and _InternalLinkedHashMap (default Map) have good asymptotic storage efficiency as the size of the collection grows. They are always better than conveniently available alternatives above 10 elements and are designed for a better locality.

source: https://github.com/dart-lang/sdk/issues/26081

Upvotes: 2

Related Questions