• Yardım
  • ListView.builder içerisindeki ExpansionTile hatası

**Merhaba,

ListView.builder içerisindeki ExpansionTile kullanıyorum. Ekranda bir tanesini açtığımda aşağıya kaydırdığım zaman geri kalanlar da kendi kendine açılıyor ve sonra da hata fırlatıyor.

Kdolar;**

@override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider<HomeModel>(
      create: (context) => locator<HomeModel>(),
      child: Consumer<HomeModel>(
        builder: (context, model, child) =>
        model.state == ViewState.girisSonucLoadingState
            ? Center(
              child: CircularProgressIndicator(
          backgroundColor: Colors.white,
        ),
            )
            : ListView.builder(
            itemCount: 10,
            itemBuilder: (context, index) {
              return ExpansionTile(
                subtitle: Text("Ad Soyad "+index.toString()),
                title: Text("Şube :"+index.toString()),
                children: <Widget>[
                  Container(
                    padding: EdgeInsets.all(4),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.stretch,
                      children: <Widget>[
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            Column(
                              children: <Widget>[
                                Padding(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Text(
                                    "Ad Soyad "+index.toString(),
                                    style: TextStyle(
                                        fontWeight: FontWeight.w700,
                                        fontSize: 14),
                                  ),
                                ),
                                Padding(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Text(
                                    "Şube "+index.toString(),
                                    style: TextStyle(
                                        fontWeight: FontWeight.w700,
                                        fontSize: 14),
                                  ),
                                ),
                                Padding(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Text(
                                    "Bölüm "+index.toString(),
                                    style: TextStyle(
                                        fontWeight: FontWeight.w700,
                                        fontSize: 14),
                                  ),
                                ),
                                Padding(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Text(
                                    "Tel "+index.toString(),
                                    style: TextStyle(
                                        fontWeight: FontWeight.w700,
                                        fontSize: 14),
                                  ),
                                ),
                              ],
                            ),
                          ],
                        ),
                        ButtonBar(
                          alignment: MainAxisAlignment.end,
                          mainAxisSize: MainAxisSize.min,
                          children: <Widget>[
                            RaisedButton(
//                                borderSide: BorderSide(
//                                    color: Colors.red),
                                onPressed: () {},
                                color: Colors.white,
                                child: Text(
                                  "SİL",
                                  style: TextStyle(
                                      color: Colors.red,
                                      fontSize: 16,
                                      fontWeight: FontWeight.w700),
                                )),
                            RaisedButton(
//                                borderSide: BorderSide(
//                                    color: Colors.green),
                                onPressed: () {
                                    Navigator.of(context).push(MaterialPageRoute(
                                               builder: (context) => DanismanGuncelle()));
                                },
                                color: Colors.white,
                                child: Text(
                                  "GÜNCELLE",
                                  style: TextStyle(
                                      color: Colors.green,
                                      fontSize: 16,
                                      fontWeight: FontWeight.w700),
                                )),
                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              );
            }),
      ),
    );
  }

}

**Oluşan Hata şu şekilde ; **

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following _CastError was thrown building NotificationListener<KeepAliveNotification>:
type 'double' is not a subtype of type 'bool' in type cast

The relevant error-causing widget was: 
  ListView file:///C:/Users/gmh/AndroidStudioProjects/flutter_app/app/lib/views/danisman_listesi.dart:37:24
When the exception was thrown, this was the stack: 
#0      _ExpansionTileState.initState (package:flutter/src/material/expansion_tile.dart:118:63)
#1      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4640:58)
#2      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
...     Normal element mounting (33 frames)
#35     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 263 pos 16: 'child == null || indexOf(child) > index': is not true.
The relevant error-causing widget was: 
  ListView file:///C:/Users/gmh/AndroidStudioProjects/flutter_app/app/lib/views/danisman_listesi.dart:37:24
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 263 pos 16: 'child == null || indexOf(child) > index': is not true.
The relevant error-causing widget was: 
  ListView file:///C:/Users/gmh/AndroidStudioProjects/flutter_app/app/lib/views/danisman_listesi.dart:37:24
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 263 pos 16: 'child == null || indexOf(child) > index': is not true.
The relevant error-causing widget was: 
  ListView file:///C:/Users/gmh/AndroidStudioProjects/flutter_app/app/lib/views/danisman_listesi.dart:37:24
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
'package:flutter/src/widgets/framework.dart': Failed assertion: line 2611 pos 20: '_debugCurrentBuildTarget == context': is not true.
The relevant error-causing widget was: 
  ListView file:///C:/Users/gmh/AndroidStudioProjects/flutter_app/app/lib/views/danisman_listesi.dart:37:24
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The method '-' was called on null.
Receiver: null
Tried calling: -(322.642939390356)
The relevant error-causing widget was: 
  ListView file:///C:/Users/gmh/AndroidStudioProjects/flutter_app/app/lib/views/danisman_listesi.dart:37:24
════════════════════════════════════════════════════════════════════════════════════════════════════

Neden kaynaklanıyor anlayamıyorum. Yardım edebilirseniz çok sevinirim.

    “type ‘double’ is not a subtype of type ‘bool’ in type cast” buradaki hata modelindeki veri tiplerinden dolayı meydana gelmektedir.

    huseyinyildirim double veya bool veri tipleriyle ilgili herhangi bir kod yazmadım. Buna nasıl müdahale etmeliyim ? Sorunun kaynağı tam olarak nedir ?

      Buradaki hatayı değerlendirerek size cevap verdim. Burada modelinizde veya yazdığınız kodlar bir cast işlemi düzgün yapılmıyor.

      `═══════ Exception caught by widgets library ══
      The following _CastError was thrown building NotificationListener<KeepAliveNotification>:
      type ‘double’ is not a subtype of type ‘bool’ in type cast

      ══════════════════════════════════`

      Write a Reply...