Skip to content

Conversation

@gaaclarke
Copy link
Member

Description of what this PR is changing or adding, and why:

Adding breaking change notice for UISceneDelegate adoption.

Issues fixed by this PR (if any):

flutter/flutter#167267

PRs or commits this PR depends on (if any):

flutter/flutter#169365

Presubmit checklist

  • This PR is marked as draft with an explanation if not meant to land until a future stable release.
  • This PR doesn’t contain automatically generated corrections (Grammarly or similar).
  • This PR follows the Google Developer Documentation Style Guidelines — for example, it doesn’t use i.e. or e.g., and it avoids I and we (first person).
  • This PR uses semantic line breaks of 80 characters or fewer.

@gaaclarke gaaclarke requested a review from vashworth May 29, 2025 22:38
gaaclarke and others added 3 commits May 30, 2025 10:19
Co-authored-by: Victoria Ashworth <15619084+vashworth@users.noreply.github.com>
Co-authored-by: Victoria Ashworth <15619084+vashworth@users.noreply.github.com>
Copy link
Member Author

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the storyboard recommendation as discussed in the chat.

@gaaclarke gaaclarke requested a review from vashworth May 30, 2025 20:26
@flutter-website-bot
Copy link
Collaborator

flutter-website-bot commented May 30, 2025

Visit the preview URL for this PR (updated for commit e875e96):

https://flutter-docs-prod--pr12082-uiscenedelegate-bjp0wxxs.web.app

@gaaclarke
Copy link
Member Author

I'm not quite sure what's breaking about my png. This seems to be following the pattern in src/content/release/breaking-changes/rendering-changes.md. The PR that introduced that though has 1600 files changed so I don't know if there is some magic I'm missing. It renders locally fine. Maybe @Sfshaza can guide me when her team gets around to reviewing it.

@vashworth
Copy link
Contributor

I'm not quite sure what's breaking about my png. This seems to be following the pattern in src/content/release/breaking-changes/rendering-changes.md. The PR that introduced that though has 1600 files changed so I don't know if there is some magic I'm missing. It renders locally fine. Maybe @Sfshaza can guide me when her team gets around to reviewing it.

Looks like images usually go under
https://github.com/flutter/website/tree/7822f909bacacb37e926b098b1183885eaa85f97/src/content/assets/images

and then they're referenced like

![adding ads](/assets/images/docs/add-payments.png)

Copy link
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it's still in draft and I edited it like it was out of draft. :)


- Landed in main: TBD
- Landed in stable: TBD
- Unknown: Apple changes their warning to an assert and Flutter apps that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaning that we don't know when this change will occur? Do we know what the Apple release number will be? Like iOS 20?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's not communicated when it will happen.

{% endtab %}
{% endtabs %}

Set up the `FlutterPluginRegistrant` programmatically through the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this sentence doing here? It seems out of place.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's describing what is happening in the code blocks. Would you like to see it before the code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would be better, but it's not worth holding this PR up if folks are running into thi problem.

@sfshaza2
Copy link
Contributor

sfshaza2 commented Jun 2, 2025

@parlough, Aaron added a screenshot to this breaking change. He put it in the assets subdirectory, under the breaking changes directory, which seems fine, and is done with other breaking changes. However, the build is breaking because it can't find the image. Might this be because of that old situation where you must put the image in place in a separate PR before referring to it? I only wonder that because the image isn't in our usual place for assets, but we've certainly done this with other breaking changes.

@sfshaza2
Copy link
Contributor

sfshaza2 commented Jun 2, 2025

@gaaclarke, I edited this more dramatically than usual, and that is because of the references to "users", which I find confusing. You mean "users of the API", or "developers". But, in actual reality, its the app's behavior that we care about, so I just removed most (all?) references to "users", rather than change them to "developers" or (better still) "you".

gaaclarke and others added 11 commits June 2, 2025 13:23
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
@gaaclarke

This comment was marked as outdated.

@parlough
Copy link
Member

parlough commented Jun 3, 2025

However, the build is breaking because it can't find the image.

I can move the image to the root directory, but I think this is more clean if we keep the image next to the markdown that uses it.

For some future infra changes, I'd prefer if we kept images in the shared /assets directory so thanks for moving it to there! Looks to be working with that change :)

I pushed some minor formatting consistency cleanup, but otherwise this looks good to me. Thanks!

@gaaclarke
Copy link
Member Author

@sfshaza2 do we want to land this now that it's on main. I see there are some other entries not associated with a stable release. Or do we want to wait until it hits stable. It might be worth waiting a few more days to make sure it sticks. There is still a small question about making a minor convenience API change that we are looking at.

@gaaclarke
Copy link
Member Author

I'm getting pings on github where users are running into this on main. It's probably worthwhile to get this landed, friendly ping.

Copy link
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sfshaza2 sfshaza2 marked this pull request as ready for review June 4, 2025 23:31
@sfshaza2 sfshaza2 requested review from a team, antfitch and parlough as code owners June 4, 2025 23:31
@sfshaza2 sfshaza2 merged commit 72d916c into flutter:main Jun 4, 2025
9 checks passed
sfshaza2 pushed a commit that referenced this pull request Jun 4, 2025
… usage (#12095)

## _Description of what this PR is changing or adding, and why:_

Updating platform channel guidance to be inline with the breaking
change: #12082

## _Issues fixed by this PR (if any):_

## _PRs or commits this PR depends on (if any):_

flutter/flutter#169365
#12082

## Presubmit checklist

- [x] This PR is marked as draft with an explanation if not meant to
land until a future stable release.
- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style) — for example, it
doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
of 80 characters or fewer.
func register(with registry: any FlutterPluginRegistry) {
let registrar = registry.registrar(forPlugin: "battery")
let batteryChannel = FlutterMethodChannel(name: "samples.flutter.dev/battery",
binaryMessenger: registrar.messenger)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Swift code does not compile. registry.registrar(forPlugin: "battery") returns a nullable value, so registrar is a FlutterPluginRegistrar?, and can't have methods called on it without unwrapping. This seems like a serious problem, because it's not clear how a Flutter app developer should if/when it's safe to assume they can actually unwrap it, or what they should do it a null check on it fails and they have critical logic that relies on it existing.

Also, it has to be messenger(), because on iOS messenger isn't declared as a property.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the example code that accompanied the change: https://github.com/flutter/flutter/blob/master/examples/platform_channel_swift/ios/Runner/AppDelegate.swift

We should update it to match the example, give that a look.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

func register(with registry: any FlutterPluginRegistry) {
let registrar = registry.registrar(forPlugin: "battery")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we forcing applications to pretend they are plugins? Couldn't the engine make a registrar internally, and the protocol apps implement give them a registrant, rather than a registry?

This is not just awkward, it's also dangerous. If the name the developer picks for this arbitrary-to-them string collides with an actual plugin's registry, Bad Things will happen.

Was there a design doc for this new system?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a design doc for this new system?

Yes, this was discussed quite a bit and there is a section for it in the design doc: https://docs.google.com/document/d/1ZfcQOs-UKRa9jsFG84-MTFeibZTLKCvPQLxF2eskx44/edit?tab=t.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not just awkward, it's also dangerous. If the name the developer picks for this arbitrary-to-them string collides with an actual plugin's registry, Bad Things will happen.

Bad things like the registrar returns nil? That's unfortunately inherent to the design of the plugins. We could provide a better example for plugin names, "flutter.dev/battery"?

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad things like the registrar returns nil?

Bad things like:

  • It will NSAssert in debug mode
  • One of the registrars will be stomped in the engine's mapping, causing any future interactions with the registry to have unexpected behavior, with the exact behavior depending on the order of operations in engine logic.

That's unfortunately inherent to the design of the plugins.

Not really. Actual plugins don't rely on individual developers to pick magic strings, we auto-generate them in the tool, where we can centrally control the set of strings and avoid collisions.

We could provide a better example for plugin names, "flutter.dev/battery"?

The fundamental problem is that this isn't a plugin. I think we should address the fact that we are requiring developers to give something that isn't a plugin a "plugin name" in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants