{"action":"created","issue":{"url":"https://api.github.com/repos/brianegan/flutter_redux/issues/15","repository_url":"https://api.github.com/repos/brianegan/flutter_redux","labels_url":"https://api.github.com/repos/brianegan/flutter_redux/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/brianegan/flutter_redux/issues/15/comments","events_url":"https://api.github.com/repos/brianegan/flutter_redux/issues/15/events","html_url":"https://github.com/brianegan/flutter_redux/issues/15","id":302389507,"number":15,"title":"Using `StoreBuilder` or `StoreConnector` results in a `NoSuchMethodError`","user":{"login":"lwasylkowski","id":12070697,"avatar_url":"https://avatars1.githubusercontent.com/u/12070697?v=4","gravatar_id":"","url":"https://api.github.com/users/lwasylkowski","html_url":"https://github.com/lwasylkowski","followers_url":"https://api.github.com/users/lwasylkowski/followers","following_url":"https://api.github.com/users/lwasylkowski/following{/other_user}","gists_url":"https://api.github.com/users/lwasylkowski/gists{/gist_id}","starred_url":"https://api.github.com/users/lwasylkowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwasylkowski/subscriptions","organizations_url":"https://api.github.com/users/lwasylkowski/orgs","repos_url":"https://api.github.com/users/lwasylkowski/repos","events_url":"https://api.github.com/users/lwasylkowski/events{/privacy}","received_events_url":"https://api.github.com/users/lwasylkowski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-05T17:24:00Z","updated_at":"2018-03-05T17:52:10Z","closed_at":null,"author_association":"NONE","body":"I'm repeatedly getting \r\n\r\n```\r\nI/flutter ( 9311): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════\r\nI/flutter ( 9311): The following NoSuchMethodError was thrown building StoreConnector<int, Store<int>>(dirty):\r\nI/flutter ( 9311): The getter 'store' was called on null.\r\nI/flutter ( 9311): Receiver: null\r\nI/flutter ( 9311): Tried calling: store\r\n```\r\n\r\nerror when trying to use `StoreBuilder` or `StoreConnector` in the hierarchy. My app widget builds the rest like this:\r\n\r\n```\r\n@override\r\nWidget build(BuildContext context) {\r\n  return new StoreProvider<int>(\r\n    store: new Store<int>(\r\n            (i, action) => i + 1,\r\n        initialState: 0\r\n    ),\r\n    child: new MaterialApp(\r\n      title: 'App',\r\n      theme: new ThemeData(\r\n        primarySwatch: Colors.blue,\r\n      ),\r\n      home: new Scaffold(\r\n          appBar: new AppBar(\r\n            title: new Text(\"App\"),\r\n          ),\r\n          body: new MainScreen(),\r\n    ),\r\n  );\r\n}\r\n```\r\n\r\nI can't get it to work, I understand `StoreProvider` is a simple InheritedWidget, but even if I try to manually call `new StoreProvider.of(context)` in a widget down the tree, I get `null`. I don't understand, since I've created dead simple inherited widget and placed it instead of `StoreProvider` and I could fetch it with `of()` method without issues (I almost did a copy-paste from the StoreProvider class).\r\n\r\nThe `int` state and inline reducer is just a result of me trying to simplify the things as much as I can, with no luck. Any idea why would it be like this?"},"comment":{"url":"https://api.github.com/repos/brianegan/flutter_redux/issues/comments/370504557","html_url":"https://github.com/brianegan/flutter_redux/issues/15#issuecomment-370504557","issue_url":"https://api.github.com/repos/brianegan/flutter_redux/issues/15","id":370504557,"user":{"login":"lwasylkowski","id":12070697,"avatar_url":"https://avatars1.githubusercontent.com/u/12070697?v=4","gravatar_id":"","url":"https://api.github.com/users/lwasylkowski","html_url":"https://github.com/lwasylkowski","followers_url":"https://api.github.com/users/lwasylkowski/followers","following_url":"https://api.github.com/users/lwasylkowski/following{/other_user}","gists_url":"https://api.github.com/users/lwasylkowski/gists{/gist_id}","starred_url":"https://api.github.com/users/lwasylkowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwasylkowski/subscriptions","organizations_url":"https://api.github.com/users/lwasylkowski/orgs","repos_url":"https://api.github.com/users/lwasylkowski/repos","events_url":"https://api.github.com/users/lwasylkowski/events{/privacy}","received_events_url":"https://api.github.com/users/lwasylkowski/received_events","type":"User","site_admin":false},"created_at":"2018-03-05T17:52:10Z","updated_at":"2018-03-05T17:52:10Z","author_association":"NONE","body":"```\r\nimport 'package:flutter/material.dart';\r\nimport 'package:flutter_redux/flutter_redux.dart';\r\nimport 'package:redux/redux.dart';\r\n\r\nvoid main() => runApp(new TestApp());\r\n\r\nclass TestApp extends StatelessWidget {\r\n\r\n  final store = new Store<int>(\r\n        (state, action) => state + 1,\r\n    initialState: 0,\r\n  );\r\n\r\n  @override\r\n  Widget build(BuildContext context) =>\r\n      new StoreProvider<int>(\r\n          store: this.store,\r\n          child: new MaterialApp(\r\n            title: \"App\",\r\n            theme: new ThemeData(\r\n              primarySwatch: Colors.blue,\r\n            ),\r\n            home: new Scaffold(\r\n              appBar: new AppBar(\r\n                title: new Text(\"App\"),\r\n              ),\r\n              body: new MainScreen(),\r\n            ),\r\n          )\r\n      );\r\n}\r\n\r\nclass MainScreen extends StatelessWidget {\r\n\r\n  @override\r\n  Widget build(BuildContext context) {\r\n    return new StoreConnector<int, String>(\r\n      converter: (state) => state.toString(),\r\n      builder: (context, text) =>\r\n      new Center(\r\n        child: new Text(text),\r\n      ),\r\n    );\r\n  }\r\n}\r\n```\r\n\r\nHere it is. Only two new dependencies in pubspec:\r\n\r\n```\r\nredux: ^2.1.1\r\nflutter_redux: ^0.3.5\r\n```\r\n\r\nFlutter doctor:\r\n\r\n```\r\nDoctor summary (to see all details, run flutter doctor -v):\r\n[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-PL)\r\n[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)\r\n[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)\r\n[✓] Android Studio\r\n[✓] Android Studio\r\n[✓] Android Studio (version 3.0)\r\n[✓] IntelliJ IDEA Community Edition (version 2017.3.4)\r\n[!] VS Code (version 1.19.2)\r\n[✓] Connected devices (1 available)\r\n\r\n! Doctor found issues in 1 category.\r\n```"}}
{"actor":{"display_login":"lwasylkowski"}}