0
FutureBuilder(
                                future: FirebaseFirestore
                                    .instance
                                    .collection('/Products/${product.id}/Variations').get(),
                                builder: (context, snapshot) {
                                  if(snapshot.hasData){
                                    print(snapshot.data!.docs.first.id);
                                    String docID = snapshot.data!.docs.first.id;
                                    return FutureBuilder(
                                      future: product.reference.collection('/Variations').doc(docID).get(),
                                      builder: (context, imageSnapshot) {
                                        if(imageSnapshot.hasData){
                                          print(imageSnapshot.data?['images'][0]);
                                          return CustomImage(
                                            imageSnapshot.data?['images'][0],
                                            radius: 10,
                                            width: 200,
                                            height: 210,//210
                                          );
                                        }else if(imageSnapshot.connectionState == ConnectionState.waiting){
                                          return const Center(
                                            child: LinearProgressIndicator(),
                                          );
                                        }
                                        else{
                                          return const Center(
                                            child: Text(
                                              "Nothings Found",
                                              style: TextStyle(
                                                  fontWeight: FontWeight.bold,
                                                  color: Colors.grey
                                              ),
                                            ),
                                          );
                                        }
                                      },
                                    );
                                  }
                                  else if(snapshot.connectionState == ConnectionState.waiting){
                                    return const Center(
                                      child: LinearProgressIndicator(),
                                    );
                                  }
                                  else{
                                    return const Center(
                                      child: Text(
                                        "Nothings Found",
                                        style: TextStyle(
                                            fontWeight: FontWeight.bold,
                                            color: Colors.grey
                                        ),
                                      ),
                                    );
                                  }
                                },
                              ),

And the Error is:

The following assertion was thrown while rebuilding dirty elements:
Assertion failed: file:///C:/flutter/packages/flutter/lib/src/foundation/stack_frame.dart:101:12
match != null
"Expected Non-error `null` thrown by JS does not have stack trace. to match RegExp/^(.+) (\\d+):(\\d+)\\s+(.+)$/."

The relevant error-causing widget was: 
  FutureBuilder<QuerySnapshot<Map<String, dynamic>>> FutureBuilder:file:///C:/Users/Rana/StudioProjects/stormymart/lib/Screens/Home/hot_deals.dart:50:33
When the exception was thrown, this was the stack: 
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:49      throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3        assertFailed
packages/flutter/src/foundation/stack_frame.dart 101:17                           _parseWebDebugFrame
packages/flutter/src/foundation/stack_frame.dart 87:14                            _parseWebFrame
packages/flutter/src/foundation/stack_frame.dart 188:14                           fromStackTraceLine
dart-sdk/lib/internal/iterable.dart 393:20                                        moveNext
dart-sdk/lib/internal/iterable.dart 871:20                                        moveNext
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 831:20  next
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 555:14                of
dart-sdk/lib/core/iterable.dart 494:7                                             toList
packages/flutter/src/foundation/stack_frame.dart 76:37                            fromStackString
packages/flutter/src/foundation/assertions.dart 1075:54                           defaultStackFilter
packages/flutter/src/foundation/assertions.dart 1269:43                           _applyStackFilter
packages/flutter/src/foundation/assertions.dart 1245:17                           new
packages/flutter/src/foundation/assertions.dart 732:22                            debugFillProperties
packages/flutter/src/foundation/diagnostics.dart 2891:17                          <fn>
packages/flutter/src/foundation/diagnostics.dart 2893:16                          get builder
packages/flutter/src/foundation/assertions.dart 1290:56                           get builder
packages/flutter/src/foundation/diagnostics.dart 2905:77                          get emptyBodyDescription
packages/flutter/src/foundation/diagnostics.dart 1621:13                          <fn>
packages/flutter/src/foundation/diagnostics.dart 1646:21                          <fn>
packages/flutter/src/foundation/diagnostics.dart 1649:14                          toJsonMap
packages/flutter/src/widgets/widget_inspector.dart 1652:18                        [_nodeToJson]
packages/flutter/src/widgets/widget_inspector.dart 929:44                         [_reportStructuredError]
packages/flutter/src/foundation/assertions.dart 1185:14                           reportError
packages/flutter/src/widgets/framework.dart 6628:16                               _reportException$
packages/flutter/src/widgets/framework.dart 5095:9                                performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                rebuild
packages/flutter/src/widgets/framework.dart 2780:18                               buildScope
packages/flutter/src/widgets/binding.dart 903:9                                   drawFrame
packages/flutter/src/rendering/binding.dart 358:5                                 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1284:15                               [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1214:9                                handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1072:5                                [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1236:13                               invoke
lib/_engine/engine/platform_dispatcher.dart 244:5                                 invokeOnDrawFrame
lib/_engine/engine/initialization.dart 190:45                                     <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39  dcall
The element being rebuilt at the time was index 0 of 12: FutureBuilder<QuerySnapshot<Map<String, dynamic>>>
  state: _FutureBuilderState<QuerySnapshot<Map<String, dynamic>>>#ad7fd

From chrome console:

Uncaught TypeError: Failed to resolve module specifier "firebase/app". Relative references must start with either "/", "./", or "../".

window.flutterWebRenderer is now deprecated. Use engineInitializer.initializeEngine(config) instead.

The above error occurs only when on the web. The image keeps loading forever.

I'm totally not getting what's going on. I'm expecting to get the images loaded properly.

  • are the images store in local assets folder or remote? if remote this could be caused from cors filter in remote server. Can you share also the console log of the browser? – Marco Lettieri Jul 24 '23 at 19:37
  • Yeah, appreciate your effort, I updated the CORS settings by following this instruction. https://stackoverflow.com/a/66104543/20727446 And build and run the application like this: flutter build web --web-renderer html --release flutter run -d chrome --web-renderer html Now, it works. – Rafiqul Islam Jul 24 '23 at 19:52

0 Answers0