{"repo":"rrousselGit/flutter_hooks","free":true,"listed":false,"github":"https://github.com/rrousselGit/flutter_hooks","clone":"git clone https://github.com/rrousselGit/flutter_hooks.git","description":"React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.","language":"Dart","stars":3333,"topics":["dart","flutter","hook","widget","code-reuse","hacktoberfest"],"license":"MIT","category":"mobile-apps","readme_excerpt":"English Português 한국어 简体中文 日本語 Flutter Hooks A Flutter implementation of React hooks: https://medium.com/@dan abramov/making-sense-of-react-hooks-fdbde8803889 Hooks are a new kind of object that manage the life-cycle of a Widget . They exist for one reason: increase the code-sharing between widgets by removing duplicates. Motivation StatefulWidget suffers from a big problem: it is very difficult to reuse the logic of say initState or dispose . An obvious example is AnimationController : All widgets that desire to use an AnimationController will have to reimplement almost all of this logic from scratch, which is of course undesired. Dart mixins can partially solve this issue, but they suffer from other problems: - A given mixin can only be used once per class. - Mixins and the class share the same object.\\ This means that if two mixins define a variable under the same name, the result may vary between compilation fails to unknown behavior. --- This library proposes a third solution: This code is functionally equivalent to the previous example. It still disposes the AnimationController and still updates its duration when Example.duration changes. But you're probably thinking: Where did all the logic go? That logic has been moved into useAnimationController , a function included directly in this library (see Existing hooks) - It is what we call a Hook . Hooks are a new kind of object with some specificities: - They can only be used in the build method of a widget that mix-in Hoo","default_branch":null,"files":null,"tree":[],"storefront":"/r/rrousselGit","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/rrousselGit/flutter_hooks/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}