text
stringlengths
1
474
<topic_start>
Fish-Redux
Fish Redux is an assembled flutter application framework
based on Redux state management.
It is suitable for building medium and large applications.<topic_end>
<topic_start>
BLoC / Rx
A family of stream/observable based patterns.<topic_end>
<topic_start>
GetIt
A service locator based state management approach that
doesn’t need a BuildContext.info Note
To learn more, watch this short Package of the Week video on the GetIt package:<topic_end>
<topic_start>
MobX
A popular library based on observables and reactions.<topic_end>
<topic_start>
Flutter Commands
Reactive state management that uses the Command Pattern
and is based on ValueNotifiers. Best in combination with
GetIt, but can be used with Provider or other
locators too.<topic_end>
<topic_start>
Binder
A state management package that uses InheritedWidget
at its core. Inspired in part by recoil.
This package promotes the separation of concerns.<topic_end>
<topic_start>
GetX
A simplified reactive state management solution.<topic_end>
<topic_start>
states_rebuilder
An approach that combines state management with a
dependency injection solution and an integrated router.
For more information, see the following info:<topic_end>
<topic_start>
Triple Pattern (Segmented State Pattern)
Triple is a pattern for state management that uses Streams or ValueNotifier.
This mechanism (nicknamed triple because the stream always uses three
values: Error, Loading, and State), is based on the
Segmented State pattern.For more information, refer to the following resources:<topic_end>
<topic_start>
solidart
A simple but powerful state management solution inspired by SolidJS.<topic_end>
<topic_start>
flutter_reactive_value
The flutter_reactive_value library might offer the least complex solution for state
management in Flutter. It might help Flutter newcomers add reactivity to their UI,
without the complexity of the mechanisms described before.
The flutter_reactive_value library defines the reactiveValue(BuildContext)
extension method on ValueNotifier. This extension allows a Widget to
fetch the current value of the ValueNotifier and
subscribe the Widget to changes in the value of the ValueNotifier.
If the value of the ValueNotifier changes, Widget rebuilds.
<topic_end>
<topic_start>Networking
<topic_end>
<topic_start>
Cross-platform http networking
The http package provides the simplest way to issue http requests. This
package is supported on Android, iOS, macOS, Windows, Linux and the web.<topic_end>
<topic_start>
Platform notes
Some platforms require additional steps, as detailed below.<topic_end>
<topic_start>
Android
Android apps must declare their use of the internet in the Android
manifest (AndroidManifest.xml):<topic_end>
<topic_start>
macOS
macOS apps must allow network access in the relevant *.entitlements files.Learn more about setting up entitlements.<topic_end>
<topic_start>
Samples
For a practical sample of various networking tasks (incl. fetching data,
WebSockets, and parsing data in the background) see the
networking cookbook.
<topic_end>
<topic_start>Fetch data from the internet
Fetching data from the internet is necessary for most apps.
Luckily, Dart and Flutter provide tools, such as the
http package, for this type of work.info Note
You should avoid directly using dart:io or dart:html
to make HTTP requests.
Those libraries are platform-dependent
and tied to a single implementation.This recipe uses the following steps:<topic_end>
<topic_start>
1. Add the http package
The http package provides the
simplest way to fetch data from the internet.To add the http package as a dependency,
run flutter pub add:Import the http package.
<code_start>import 'package:http/http.dart' as http;<code_end>
If you are deploying to Android, edit your AndroidManifest.xml file to
add the Internet permission.Likewise, if you are deploying to macOS, edit your
macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements
files to include the network client entitlement.<topic_end>
<topic_start>
2. Make a network request
This recipe covers how to fetch a sample album from the
JSONPlaceholder using the http.get() method.
<code_start>Future<http.Response> fetchAlbum() {