app_state 0.8.3 app_state: ^0.8.3 copied to clipboard
A state management solution on top of Router API for larger apps.
0.8.3 #
- Added
PagePath.uri
. - Added
PagePath.getUriAtBase()
. - Relaxed mockito version requirement.
0.8.2 #
- Allow
PageStack.replacePath
withoutRouteInformationParser
.
0.8.1 #
- Exports
PageStacksStackEvent
.
0.8.0 #
- BREAKING: Removed all functionality deprecated in v0.6 and v0.7.
0.7.4 #
- Added
PageStacksBuilder
widget. - Refactored the
5_route_result
example to useChangeNotifier
instead of bloc. - Incorporated the older separate medium tutorials in the READMEs:
- Fixed image links in
/example/README.md
. - Added 'Support: Telegram' shield.
0.7.3 #
- Fixed image paths.
0.7.2 #
- Fixed linter issues, formatted examples, added the format check to the CI.
- Moved to
app_state
subdirectory.
0.7.1 #
- Moved the examples to the package's repository.
0.7.0 #
Most of the references to BLoC were removed from the package to allow any implementation for
state management:
custom BLoC, BLoC or Cubit from the bloc package,
ChangeNotifier
, or anything else. Deprecated typedef
s to the older classes and
deprecated aliases to older members were added to soften the change.
This is a short-lived major version to migrate from those deprecated API to the new one but to still be able to run your app in the process. Every deprecation in this version is scheduled for removal in v0.8.0.
- BREAKING: While removing references to BLoC, named arguments to some constructors and methods
could not be easily backed by anything backward compatible, and they were hard-renamed:
PageStackPageBlocEvent
:- was renamed to
PageStackPageEvent
. bloc
was changed toPageStateMixin state
.pageBlocEvent
was renamed topageEvent
.
- was renamed to
PageStacksPageStackBlocEvent
:- was renamed to
PageStacksStackEvent
. bloc
was renamed tostack
.pageStackBlocEvent
was renamed topageStackEvent
.
- was renamed to
MaterialPageStacksRouterDelegate.pageStacksBloc
was changed from a named constructor argument to a positional one and renamed topageStacks
.PageStackNavigator.bloc
was renamed tostack
.
- BREAKING:
PageStack.pages
is now anUnmodifiableListView
and not the actual list. - Renamings backed by deprecated
typedef
s and member aliases that are thus non-breaking:PageBloc
was changed toPageStateMixin
mixin. To continue using custom blocs as in the previous versions, mix it in withwith
keyword instead of extendingPageBloc
. The newly deprecatedPageBloc
is changed to mix in this mixin.PageBlocEvent
was renamed toPageEvent
.PageBlocPathChangedEvent
was renamed toPagePathChangedEvent
.- In
enum PopCause
:pageBloc
was renamed topage
.pageStackBloc
was renamed topageStack
.
PageBlocPopEvent
was renamed toPagePopEvent
.PageStackBackButtonDispatcher.pageStackBloc
was renamed topageStack
.PageStacksBackButtonDispatcher.pageStacksBloc
was renamed topageStacks
.PageStackBlocEvent
was renamed toPageStackEvent
.PageStackRouterDelegate.pageStackBloc
was renamed topageStack
.PageStacksBloc
:- was renamed to
PageStacks
. currentStackBloc
was renamed tocurrentStack
.
- was renamed to
PageStacksBlocEvent
was renamed toPageStacksEvent
.PageStacksRouterDelegate.pageStacksBloc
was renamed topageStacks
.CAbstractPage.bloc
was changed toPageStateMixin state
.
PageStackEvent
now has type parameter<P extends PagePath>
.PageState
class is added as the default class that usesPageStateMixin
.- All classes using
C
prefix were changed toP
prefix. Deprecatedtypedef
s added for backward compatibility. That prefix was historical when the term 'configuration' was used instead of 'path'. The newP
stands for 'path'. These classes are meant for apps that have a common superclass underPagePath
. All other apps should use the same classes without prefixes.
0.6.10 #
- Added
PageStacksConfigurationChangedEvent
.
0.6.9 #
- Preserves the state on browser refresh button press by using https://pub.dev/packages/flutter_issue_108697_workaround
- Renamed
PageStackBlocNavigator
toPageStackNavigator
. A deprecatedtypedef
was added for backward compatibility.
0.6.8 #
- Added
PageStackRouterDelegate.observers
,PageStackRouterDelegate.transitionDelegate
.
0.6.7 #
- Added
PageStackBlocNavigator.observers
,PageStackBlocNavigator.transitionDelegate
.
0.6.6 #
- Updated example links.
0.6.5 #
- Added
PageStackBloc.popUntilBottom()
, it uses the newPopCause.pageStackBloc
. PageBlocPopEvent
is now always created with the correctR
type. Before it had beenconst PageBlocPopEvent<Null>
for pops without data.- Improved test coverage.
- Fix formatting.
- Add comparison to auto_route and go_router to README.
0.6.4 #
- Added
PageStackBloc.replaceWith
to declaratively navigate to a given path with two options:- Replacing the stack unconditionally with
mode: PageStackMatchMode.none
. - Preserving the states of pages that exist in both the old and the new stack with
mode: PageStackMatchMode.keyOrNullPathNoGap
.
- Replacing the stack unconditionally with
- Added
mode
argument toPageStackBloc.setConfiguration
to choose the match mode the same way as inreplaceWith
. - Added
PageBlocCloseEvent.cause
to tell between the back button close, the bloc's own intention to close, and a kick-out as a result of stack diff. BlocMaterialPage
is now non-abstract.- Fixed issue when page stack was allowed to be emptied and stayed defunct afterwards Issue 3. The emptying operation is now reverted.
- Removed code duplication by handling all page removals in
PageStackBloc.handleRemoved()
. - Expand tests.
0.6.3 #
- Renamed
PageBlocCloseEvent
toPageBlocPopEvent
to align withdidPopNext
method. - A deprecated
typedef
was created for backwards compatibility.
0.6.2 #
- Renamed
PageConfiguration
toPagePath
. Atypedef
for backwards compatibility is added. Methods, getters, and arguments with pages' 'configuration' in its name were changed to use 'path', deprecated copies of the old ones were added for backwards compatibility. ThePageConfiguration
's name was a permanent source of confusion. Each doc had to start with a note thatPageConfiguration
corresponds to a URL, and it was not easy to memorize. This change will simplify the learning of this package. It has also stripped 9-13 characters from identifiers.Path
is inspired by the original article announcing Router API (as well asapp_state
name itself was).Configuration
earlier was inspired byRouter
docs where it means the configuration of the whole app (earlier versions ofapp_state
were designed to allow storing only the top page's state, and so 'configuration' was extended to pages as well). 'Configuration' is still used inPageStackConfiguration
andPageStacksConfiguration
class names that do represent the whole app's state, and that is correct. - Deprecated
PagePath.restoreRouteInformation
. It used to allow overridingstate
and was confusing because it was not used in serializing for browser history (super.state
is).
0.6.1 #
- Fix images in README.
0.6.0 #
- BREAKING: All classes that had a type parameter
<C extends PageConfiguration>
no longer have it. The idea of this type parameter is to have a subclass that is a superclass to all of your configurations. An example is when you store a language slug there, and it must be automatically present in all your configurations. These cases are rare, and most of the time<PageConfiguration...
only clutters the code when you must provide some other typed parameters likePageBloc
type or the return value. All such classes were renamed in a pattern ofPageBloc<C, R> -> CPageBloc<C, R>
. Thentypedef
s were added liketypedef PageBloc<R> = CPageBloc<PageConfiguration, R>
. If you need the common subclass ofPageConfiguration
, just addC
before all such typed parent classes to get it back. Otherwise just remove<PageConfiguration>
from your code. - BREAKING: When
PageStackBloc
compares pages tonull
PageConfiguration
, it ignores the page keys and never disposes such pages. This is to allow non-web apps without anyPageConfiguration
classes. Otherwise the pages were always kicked out when comparing tonull
PageConfiguration
. No practical use cases were affected. PageConfiguration
classes are now optional for all non-web apps and web apps that do not care for URLs.PageConfiguration
is now non-abstract and has/
as the defaultlocation
.PageConfiguration
objects no longer need to parseRouteInformation.state
in theirtryParse
. To benefit from this, stop overridingparseRouteInformation
in your parser and override one of the new methods instead:parsePageConfiguration
,PageStackRouteInformationParser.parsePageStackConfiguration
,PageStacksRouteInformationParser.parsePageStacksConfiguration
. These methods are only called when failed to extract state fromRouteInformation
, i.e. when the URL is typed in, and so no non-URL state information is present.PageStackConfiguration.getTopPageConfiguration()
is now nullable and returns null if none of the pages in the stack havePageConfiguration
.PageStackRouteInformationParser
andPageStacksRouteInformationParser
can now be used without subclassing in all non-web apps and web apps that do not care for URLs. By return they parsenull
PageConfiguration
objects.PageStackRouteInformationParser
andPageStacksRouteInformationParser
in theirrestoreRouteInformation
now return all their stack/stacks states to store in browser history and not only that of the topPageConfiguration
.- Added
const
constructors toPageStackRouteInformationParser
andPageStacksRouteInformationParser
. PageStackRouteInformationParser
andPageStacksRouteInformationParser
now haveparsePageConfiguration
to only parse the singlePageConfiguration
. This way the superclasses calldefaultStackConfiguration
anddefaultStacksConfiguration
so you don't have to. They are the recommended replacements to respectiveparseRouteInformation
methods. They are called only when failed to recover fromRouteInformation.state
. To use them, stop overridingparseRouteInformation
.PageStackRouteInformationParser
now hasparsePageStackConfiguration
, andPageStacksRouteInformationParser
now hasparsePageStacksConfiguration
. They are the alternative replacements to respectiveparseRouteInformation
methods in case you need additional logic to recover the stack state that cannot be derived from yourPageConfiguration
alone. They are called only when failed to recoverRouteInformation.state
. To use them, stop overridingparseRouteInformation
.
0.5.1 #
- Added
PageConfiguration.location
. - Added
PageConfiguration.defaultStackConfigurations
.
0.5.0 #
- BREAKING: Pages, Blocs an
PageBlocCloseEvent
have a newR
type parameter for the return result. The actual result is ofR?
withnull
if closing without data. - BREAKING:
PageBlocCloseEvent
has a new requireddata
property of typeR
. It is encouraged to use it instead of subclassingPageBlocCloseEvent
. - BREAKING: Page classes no longer have
const
constructors because they haveCompleter
s now. - Added
PageBloc.pop(data)
. - Added
PageBloc.didPopNext(page, event)
. PageStackBloc.push
returns aFuture
that completes when the page is popped.- Deprecated
PageBloc.onForegroundClosed
in favor ofdidPopNext
. - Deprecated
PageBloc.closeScreen
andPageBloc.closeScreenWith
in favor ofpop
.
0.4.0 #
- BREAKING: Require Flutter 3.
- Re-licensed under MIT No Attribution.
- Using
total_lints
, fix linter issues.
0.3.5 #
- Fix duplicate page key handling.
0.3.4 #
- Call const constructors where possible.
- Applied
dart format
. - Added features to
README.md
0.3.3 #
- Added
MaterialPageStacksRouterDelegate
. - Added
StatefulBlocWidget
.
0.3.2 #
- Const constructors for
PageBlocCloseEvent
,PageBlocConfigurationChangedEvent
,PageStackConfiguration
. - Link to tutorials.
0.3.1 #
- Wrap
PageStackBlocEvent
asPageStacksBlocEvent
.
0.3.0 #
- BREAKING: Remove
AppBloc
. - Add
PageStacksBloc
,PageStacksConfiguration
,PageStacksRouteInformationParser
,PageStacksRouterDelegate
. - Add
PageConfiguration.defaultStackKey
,defaultStacksConfiguration
.
0.2.1 #
- An accidental debug print removed.
0.2.0 #
- BREAKING:
PageConfiguration
is now abstract, addedrestoreRouteInformation()
. - Added
PageConfiguration.defaultStackConfiguration
. - Added
PageStackConfiguration.getTopPageConfiguration()
. - Added
PageStackRouteInformationParser
.
0.1.6 #
- Fix
onPopRoute
inPageStackBlocNavigator
.
0.1.5 #
- Added
PageStackRouterDelegate
.
0.1.3 #
- Added
PageBloc.closeScreenWith
,PageBloc.onForegroundClosed
.
0.1.2 #
- BREAKING: Renamed
AppBlocNormalizedState
toAppConfiguration
. - BREAKING: Renamed
PageStackBlocNormalizedState
toPageStackConfiguration
. - BREAKING: Renamed
ScreenBlocNormalizedState
toPageConfiguration
. - BREAKING: Renamed
Screen...
events toPage...
events. - BREAKING: Extracted
PageBloc.states
to the newPageStatefulBloc
subclass. PageBloc
is not abstract.- Allow to specify duplicate key behavior per push.
- Allow
null
for page keys. - Added docs.
0.1.1 #
- BREAKING: Removed
ScreenBlocConfigurationChangedEvent.configuration
. - Added
AppBloc
. - Added
AppBlocNormalizedState
,PageStackBlocNormalizedState
,ScreenBlocNormalizedState
. - Normalize and denormalize state.
- Create pages in
PageStackBloc
.
0.1.0 #
- Initial release.