title: Provider: "Bad state: Tried to read a provider that threw during the creation of its value"
body: <p>I am using the library <strong><a href="https://pub.dev/packages/provider" rel="noreferrer">Provider</a></strong> like this:</p>
  <pre><code>runApp(
      LocalizedApp(
        delegate,
        MyApp(
          localizedValues: {},
        ),
      ),
    );
  </code></pre>
  <p>and then:</p>
  <pre><code>class MyApp extends StatelessWidget {
    final Map&lt;String, Map&lt;String, String&gt;&gt; localizedValues;
    MyApp({required this.localizedValues});
  
    @override
    Widget build(BuildContext context) {
      final localizationDelegate = LocalizedApp.of(context).delegate;
  
      return MultiProvider(
        providers: [
          ChangeNotifierProvider(create: (_) =&gt; MyRents()),
        ],
        child: MaterialApp(
          initialRoute: initialRoute,
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        localizationDelegate
      ],
  </code></pre>
  <p>This is my provider:</p>
  <pre><code>class MyRents extends ChangeNotifier {
  // LIST OF VARS NOT USED AT THIS POINT
  
    bool loadingUserInfo = false;
    var language;
    // List list = rentsList;
    List list = [];
    int currentPortfolioIndex = 0;
    int currenRentIndex = 0;
    var clonedRent;
    List newGalleryImages = []; // local gallery images that we haven't pushed yet
    SharedPreferences? prefs;
    String viewMode = 'multi';
    bool galleryScrollView = true;
    PageController portfolioController = PageController(initialPage: 0);
    MyUser? user; // TODO: move this to a separate provider
    List&lt;ProductDetails&gt; products = [];
    List&lt;PurchaseDetails&gt; purchases = [];
    bool showAds = false;
    Map companyInfo = {};
    List withholdings = [];
    List&lt;QueryDocumentSnapshot&gt; taxes = [];
  // END LIST
  
  
    // MyRents(); // TODO: check null (this was working in Flutter 1 but not now so it might be related to the error)...
    final MyRents myRents = MyRents(); // ...and this is the Flutter 2 version
  
    updateUI() {
      notifyListeners();
    }
  }
  
  final MyRents myRents = MyRents();
  </code></pre>
  <p>This was working well in Flutter 1 but I'm getting this error now in Flutter 2:</p>
  <blockquote>
  <p>Reassembling main.dart$main-2339422228391703 failed:
  ext.flutter.reassemble: (-32000) Server error {&quot;exception&quot;:&quot;Bad state:
  Tried to read a provider that threw during the creation of its
  value.\nThe exception occurred during the creation of type
  MyRents.&quot;,&quot;stack&quot;:&quot;#0      _CreateInheritedProviderState.value
  (package:provider/src/inherited_provider.dart:661:7)\n#1<br />
  _InheritedProviderScopeElement.reassemble (package:provider/src/inherited_provider.dart:367:60)\n#2<br />
  Element.reassemble.
  (package:flutter/src/widgets/framework.dart:3072:13)\n#3<br />
  ComponentElement.visitChildren
  (package:flutter/src/widgets/framework.dart:4549:14)\n#4<br />
  Element.reassemble
  (package:flutter/src/widgets/framework.dart:3071:5)\n#5<br />
  Element.reassemble.
  (package:flutter/src/widgets/framework.dart:3072:13)\n#6<br />
  ComponentElement.visitChildren
  (package:flutter/src/widgets/framework.dart:4549:14)\n#7<br />
  Element.reassemble
  (package:flutter/src/widgets/framework.dart:3071:5)\n#8<br />
  Element.reassemble.
  (package:flutter/src/widgets/framework.dart:3072:13)\n#9<br />
  ComponentElement.visitChildren
  (package:flutter/src/widgets/framework.dart:4549:14)\n#10<br />
  Element.reassemble
  (package:flutter/src/widgets/framework.dart:3071:5)\n#11<br />
  Element.reassemble.
  (package:flutter/src/widgets/framework.dart:3072:13)\n#12<br />
  ComponentElement.visitChildren
  (package:flutter/src/widgets/framework.dart:4549:14)\n#13<br />
  Element.reassemble
  (package:flutter/src/widgets/framework.dart:3071:5)\n#14<br />
  Element.reassemble.
  (package:flutter/src/widgets/framework.dart:3072:13)\n#15<br />
  ComponentElement.visitChildren
  (package:flutter/src/widgets/framework.dart:4549:14)\n#16<br />
  Element.reassemble
  (package:flutter/src/widgets/framework.dart:3071:5)\n#17<br />
  Element.reassemble.
  (package:flutter/src/widgets/framework.dart:3072:13)\n#18<br />
  ComponentElement.visitChildren
  (package:flutter/src/widgets/framework.dart:4549:14)\n#19<br />
  Element.reassemble
  (package:flutter/src/widgets/framework.dart:3071:5)\n#20<br />
  StatefulElement.reassemble
  (package:flutter/src/widgets/framework.dart:4624:11)\n#21<br />
  Element.reassemble.
  (package:flutter/src/widgets/framework.dart:3072:13)\n#22<br />
  RenderObjectToWidgetElement.visitChildren
  (package:flutter/src/widgets/binding.dart:1139:14)\n#23<br />
  Element.reassemble
  (package:flutter/src/widgets/framework.dart:3071:5)\n#24<br />
  BuildOwner.reassemble
  (package:flutter/src/widgets/framework.dart:2892:12)\n#25<br />
  WidgetsBinding.performReassemble
  (package:flutter/src/widgets/binding.dart:951:19)\n#26<br />
  BindingBase.lockEvents
  (package:flutter/src/foundation/binding.dart:298:41)\n#27<br />
  BindingBase.reassembleApplication
  (package:flutter/src/foundation/binding.dart:338:12)\n#28<br />
  BindingBase.registerSignalServiceExtension.
  (package:flutter/src/foundation/binding.dart:375:23)\n#29<br />
  BindingBase.registerSignalServiceExtension.
  (package:flutter/src/foundation/binding.dart:374:17)\n#30<br />
  BindingBase.registerServiceExtension.
  (package:flutter/src/foundation/binding.dart:597:32)\n\n&quot;,&quot;method&quot;:&quot;ext.flutter.reassemble&quot;}</p>
  </blockquote>
  <p>and this other one:</p>
  <blockquote>
  <p>======== Exception caught by Flutter framework ===================================================== The following StateError was thrown during a service extension callback for
  &quot;ext.flutter.reassemble&quot;: Bad state: Tried to read a provider that
  threw during the creation of its value. The exception occurred during
  the creation of type MyRents.</p>
  </blockquote>