Getting "Another exception was thrown: Instance of 'minified:bV<void>'" while running flutter app on web (localhost)
Asked Answered
R

10

21

I am working on a flutter application. Recently I have enabled this application for web and its running fine if I run it from Android Studio by clicking on Run button. The problem is when I run it on localhost or I build it for release it gives en error that is Another exception was thrown: Instance of 'minified:bV<void> and the page appears blank in gray color.

In the page that is broken, I have used flower kind of layout. I have modified this library. It was working fine on localhost too before but, its breaking now.

Please suggest.

Below are the details:

Flutter Version - v1.14.6 (Beta)

Commands: I use below commands to run the app on localhost.

cd build/web
flutter build web -t lib/main_web.dart
flutter pub global activate dhttpd
flutter pub global run dhttpd

Thanks in advance.

Restaurateur answered 3/4, 2020 at 5:46 Comment(1)
Hi, have you found any solution? I'm having the same grey screen problem. In my case the problem is caused by a platform check. Here is my question if you wanna have a look at it. #62215715 CheersRalf
M
8

My console displayed a similar error message to yours, as well as a blank grey screen. After searching for few days, I found out that the error could be due to an expanded or flexible widget.

solution:

just try to remove or replace Expanded widget, it worked for me

Thank you

Mohsen answered 21/9, 2021 at 7:43 Comment(3)
Bro.. How to use expanded or flexible then?Dominance
Sorry I am not that professional in flutter it just using the above sol I resolved the issue and here I just shared mine experience, But give me some time I'll try to find some better solution soon or substitute for using expanded. Thank you!!Mohsen
I thought @Wesley answer will work but fortunately, Tarun solution worked for me. I am also using .dotenv package but it does not give me any errors.Belindabelisarius
S
5

For me, it meant I had a null value somewhere. After searching deeper, it was .env_prod files that work for web on local builds in Chrome, but not once published. i had to use "dotenv_prod" for my variable files.

Seppuku answered 2/5, 2021 at 13:12 Comment(4)
Kudos! The only answer that helped me.Hierolatry
The dot env package documentation I think does not mention this, not sure if it was updated. An issue was raised.Seppuku
Hi, I know it's been a while but what exactly do I change for my .env file? Do I change my file name to "dotenv_prod.env"?Kolkhoz
@KelvinJou I just called it dotenv_prod.env yesSeppuku
E
3

I had the same error. I don't know enough flutter on a technical level but what fixed it for me was changing the root widget of the web page to a Scaffold .

Ephedrine answered 1/2, 2021 at 5:51 Comment(0)
C
2

I had the same problem. I couldn't trace it back to what caused it. In the end, two things "fixed" it: When building my app I had to

  1. use Flutter's canvas renderer (https://docs.flutter.dev/platform-integration/web/renderers)
  2. use --release switch

I used the command flutter build web --web-renderer canvaskit --release to build my app and the error went away.

Cerussite answered 29/8, 2023 at 17:17 Comment(0)
C
0

I had the same issue using FlutterFlow.io and using a Custom Widget on a page. FlutterFlow exposes a widget property: "Enforce width & Height". When this property is set, FlutterFlow generates the code for a new Container and places the Custom Widget in that container.

Which means that Custom Widget I was using was causing a lot of screen overflow errors w/o this new Container.

So it seems that this error is caused by Flutter not being able to figure out how to bound the widget (?).
Add a container and see...

Cooksey answered 4/12, 2022 at 18:9 Comment(0)
T
0

The problem comes from the usage of dotenv package. You can use in your code the environment variable like this.

class Environment {
  static String get appEnv =>
      const String.fromEnvironment(
          'APP_ENV',
          defaultValue: 'dev'
      );
}

and build your app with this argument :

flutter build web --dart-define=APP_ENV=staging
Trapeziform answered 18/8, 2023 at 8:59 Comment(0)
A
0

I had almost exactly the same issue, I thought there was nothing wrong because with flutter run, there were everything all right, but in deployment got the grays creen, reading some comments about the Expanded and checking the console output, I figured out that there are some widgets that can not have an Expanded or Flexible as child, in my case it was a Stack, I just wraped the Expanded with a Row, and the error in console disapeared, therefore gray screen too... hope this help anyone to understand this kind of mistake, because (in my case), didn't know about this limitations using Expanded or Flexible and didn't paid enough attention to the console. PD: Sorry if i am commiting grammatical mistakes, this isn't my native language :D

Allnight answered 8/9, 2023 at 19:7 Comment(0)
E
0

. , Solved mine by removing a function that returns a widget from a catch function (that should have its own conditional statement), forgot to rectify sooner my bad.

Elevon answered 25/9, 2023 at 3:17 Comment(0)
H
0

The error was caused on flutter web and only at release mode.

The code which caused the error was putting Flexible inside SizedBox.

return SizedBox(
        height: 140,
        child: Flexible(
          child: Scrollbar(
            thumbVisibility: true,
            child: GridView.builder(
              gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 4,
                childAspectRatio: 2.25,
              ),
              itemCount: years.length,
              itemBuilder: (BuildContext context, int index) {
return MyWidget();
    }))));

Then I changed the code like below ie Putting the Scrollbar inside Expanded without Container

return Expanded(
      child: Cardd(
        opacity: 0.075,
        color: Colors.blueGrey,
        child: Scrollbar(
          thumbVisibility: true,
          child: GridView.builder(
            gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 4,
              childAspectRatio: 2.25,
            ),
            itemCount: years.length,
            itemBuilder: (BuildContext context, int index) {
              return MyWidget();
            },
          ),
        ),
      ),
    );
  }
Haun answered 30/9, 2023 at 10:8 Comment(0)
M
0

In case your widgets have parameters and you are using Firestore, avoid using parameters of type QueryDocumentSnapshot<Map<String, dynamic>>? Instead use DocumentSnapshot<Map<String, dynamic>>?

Example:

class InviteListItemMimi extends StatefulWidget {
  final String inviteId;
  final DocumentSnapshot jobSeekerDocument;
  final DocumentSnapshot jobDocument;
  final DocumentSnapshot<Map<String, dynamic>>? applicationDocument;

  const InviteListItemMimi({
    super.key,
    required this.inviteId,
    required this.jobSeekerDocument,
    required this.jobDocument,
    required this.applicationDocument,
  });
  ...
Murraymurre answered 23/5 at 2:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.