Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the "minified:aq<void>" flutter web error

Tags:

flutter

dart

I recently started developing on flutter web I created a project with a bdd firebase but every time I send my files to the server and I launch on my browser the site there is an error message in the console that appears I can't find where it comes from and I would like to envy it because it stresses me Another exception was thrown: Instance of 'minified:aq' that comes from the file js_primitives.dart I put the picture below you.

Error while fetching an original source: NetworkError when attempting to fetch resource. Source URL: org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_primitives.dart

for the creation of the project I made the command "flutter create..." to build the project the command "flutter build web"

pics

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:firebase/firebase.dart' as fb;
import 'package:firebase/firestore.dart' as fs;


class FirebaseHelper {
  bddCon() {
      try {
        if (fb.apps.isEmpty) {
          fb.initializeApp(
            apiKey: "AIzaSyDXH2wp7lP5xPA23iIJo3bqJOs5qHD9MMs",
            authDomain: "test-c03a7.firebaseapp.com",
            databaseURL: "https://test-c03a7.firebaseio.com",
            projectId: "test-c03a7",
            storageBucket: "test-c03a7.appspot.com",
            messagingSenderId: "356936613410",
            appId: "1:356936613410:web:464a1dcb25010b0f4cd47b",
            measurementId: "G-J14GG7YZ45"
          );      
        }
      } on fb.FirebaseJsNotLoadedException catch (e) {
        print(e);
      }
      return fb.firestore();
  }
}

void main()
{
  FirebaseHelper().bddCon();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  static fs.Firestore store = fb.firestore();
  fs.CollectionReference ref = store.collection("user");
var map = {'text': "okok", 'createdAt': DateTime.now()};
  Future<FirebaseUser> _incrementCounter() async {
    print("wsh");
    await ref.add(map);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
like image 679
dafep Avatar asked Dec 08 '19 20:12

dafep


Video Answer


1 Answers

To get more readable information on what's going on, use

flutter run -d chrome --profile --verbose

Same error happened to me several times within recent days. I tried several version of Flutter, sometimes worked sometimes not. Yesterday it happened again, had no clue how to make it work, until I use --profile to get more readable information. In my case, it was an static method uninitialized unexpectedly that triggered this issue. Seems like a webdev bug , only failed on web release build.

like image 174
Curtis Chang Avatar answered Nov 02 '22 19:11

Curtis Chang