Skip to content

Would like instructions on how to implement onSaveInstanceState #2004

Closed

Description

@zoechi

@eseidelGoogle commented on Fri Apr 20 2018

https://twitter.com/championswimmer/status/987327881960357889

My understanding is that FlutterView will handle the config change if AndroidManifest.xml contains:
android:configChanges="orientation|screenSize"
https://developer.android.com/guide/topics/resources/runtime-changes.html

But I'm not sure that we've written that down anywhere in our docs. I believe some of our sample are locked to portrait for historical reasons too?


@eseidelGoogle commented on Fri Apr 20 2018

I'm aware of at least one bug reported with Flutter's rotation code: flutter/flutter#16322 there may be others.


@championswimmer commented on Fri Apr 20 2018

There needs to be documentation regarding how onSaveInstanceState is to be implented in Flutter as well.


@championswimmer commented on Fri Apr 20 2018

Also pertinent : flutter/flutter#6827
And dupe: flutter/flutter#3427


@Sfshaza commented on Sat May 19 2018

Yes, added to doc content plan.


@Sfshaza commented on Thu May 31 2018

OK, PR #1037 handles documenting how to configure landscape view, and also that android should not restart a Flutter app.

The onSaveInstanceState doc is not yet written.


@mzgreen commented on Wed Jun 27 2018

Please note that onSaveInstanceState is not only about persisting state during config changes. More important part is that it's used it to persist transient app state when OS kills the app.
https://developer.android.com/topic/libraries/architecture/saving-states#system_initiated_ui_state_dismissal

Activity

  1. sfshaza2 commented on Jan 29, 2019

    @sfshaza2
    Contributor

    Still true.

  2. added
    e2-daysEffort: < 5 days
    p1-highMajor but not urgent concern: Resolve in months. Update each month.
    on Jan 29, 2019
  3. championswimmer commented on Jan 31, 2019

    @championswimmer

    This is best addressed with documentation head on. We do not want truckloads of users knee deep into Flutter codebase, realising after almost shipping their app that they have no idea about the lifecycle of Android activities.

  4. self-assigned this
    on Mar 29, 2023
  5. added a commit that references this issue on Apr 25, 2023
  6. added a commit that references this issue on May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cl.fixedIssue is closed as fixede2-daysEffort: < 5 daysp1-highMajor but not urgent concern: Resolve in months. Update each month.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions