Coder Social home page Coder Social logo

Comments (10)

pythoneer avatar pythoneer commented on July 29, 2024 4

Sorry i don't know what exactly i did wrong in my first attempt to create a minimal example. Today i tried it a second time and i could fully recreate the problem and have a reproducible crash example.

pubspec.yaml

name: inner_drawer_flutter2_test
description: A new Flutter application.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=2.12.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  flutter_inner_drawer: ^1.0.0+1

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

main.dart

import 'package:flutter/material.dart';
import 'package:flutter_inner_drawer/inner_drawer.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return InnerDrawer(
        rightChild: Center(
            child: Text(
          "drawer",
          style: TextStyle(color: Colors.white),
        )),
        scaffold: Scaffold(
          body: Center(child: Text("body")),
        ));
  }
}

This is crashing immediately after the application starts with the error shown in my comment above. This is happening on my Pixel 4 with Android 11 but i don't think it matters.

inner_drawer_crash

from flutter_inner_drawer.

pythoneer avatar pythoneer commented on July 29, 2024 2

As i see it, there is a PR pending that is fixing this error. I was closing my PR in favor to the one that was already there and has an equivalent fix to mine (i just didn't look out for an existing PR because i thought i would be already merged by now)

the PR in question: #69

from flutter_inner_drawer.

meg4cyberc4t avatar meg4cyberc4t commented on July 29, 2024 2

I caught the same exception, but I see that you stopped discussing it in 2021. As a result, is there a solution?

from flutter_inner_drawer.

pythoneer avatar pythoneer commented on July 29, 2024

having the same problem after upgrading my project to Flutter2 null-safety. Haven't build a minimal example yet because i was of the impression that it has something to do with my client code. But after erasing almost all of my code i was left with an almost bare bones version of the InnerDrawer. I am about to create a project from scratch just to make sure.

flutter doctor:

$> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.4, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

pubspec.yaml entry
flutter_inner_drawer: ^1.0.0+1

runtime error message:

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following _CastError was thrown building InnerDrawer-[LabeledGlobalKey<InnerDrawerState>#146ed](dirty, dependencies: [MediaQuery, _EffectiveTickerMode], state: InnerDrawerState#d921d(ticker inactive)):
type 'List<Widget?>' is not a subtype of type 'List<Widget>' in type cast

The relevant error-causing widget was: 
  InnerDrawer-[LabeledGlobalKey<InnerDrawerState>#146ed] file:///home/naikon/Documents/arbeit/dev/git-repos/academic-lapp-mobile/lib/screen/main2.dart:164:16
When the exception was thrown, this was the stack: 
#0      InnerDrawerState._scaffold (package:flutter_inner_drawer/inner_drawer.dart:437:21)
#1      InnerDrawerState.build (package:flutter_inner_drawer/inner_drawer.dart:614:55)
#2      StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)
#3      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
#4      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4667:11)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by scheduler library ═════════════════════════════════════════════════════
Null check operator used on a null value
════════════════════════════════════════════════════════════════════════════════════════════════════

EDIT1:
I have build a minimal example and it is working. But i can't spot an obvious difference to the code i use in my regular application. The only obvious thing is that in my regular application the InnerDrawer is deeper nested into the widget tree but i don't think this is really relevant but i am trying to recreate this anyway because i don't see any other relevant difference.

from flutter_inner_drawer.

rafaelsetragni avatar rafaelsetragni commented on July 29, 2024

I did a fix for this error. The pull request is in
Fix for cast widget list for dart null safety

from flutter_inner_drawer.

pythoneer avatar pythoneer commented on July 29, 2024

Hi @rafaelsetragni there are already multiple PRs for fixing this. I closed mine in favor for the PR that was already there #69 and i don't think the problem is a shortage of PRs to fix the problem. The main problem is merging and releasing the Fix that is already there.

from flutter_inner_drawer.

AliHoseinpoor avatar AliHoseinpoor commented on July 29, 2024

i have the same problem

from flutter_inner_drawer.

mqhamdam avatar mqhamdam commented on July 29, 2024

coming with same issue

from flutter_inner_drawer.

AliHoseinpoor avatar AliHoseinpoor commented on July 29, 2024

can you fix this issue ?

from flutter_inner_drawer.

mqhamdam avatar mqhamdam commented on July 29, 2024

I just downloaded all package source code and changed it as mentioned in the pull request.

see there:
#73

from flutter_inner_drawer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.