Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@luckysmg
Copy link
Contributor

@luckysmg luckysmg commented Oct 14, 2021

We can use like this:

let engineGroup = FlutterEngineGroup(name: "io.flutter", project: nil)
window?.rootViewController = FlutterViewController(engineGroup: engineGroup, nibName: nil, bundle: nil, entrypoint: nil, libraryURI: nil, initalRoute: nil)

List which issues are fixed by this PR. You must list at least one issue.
flutter/flutter#72742

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Member

@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.

The code is correct and it makes sense, but I think we should error on the side of keeping the API as simple as possible. This convenience function is something you could just have in your project and isn't something that is required to be in the Flutter API.

@xster I know you write the issue this fixes, what do you think about this now?

Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

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

Thanks. I think this is helpful. We should keep parity between the platforms however. There should be an Android solution as well (though I acknowledge it'll be a lot more complicated than iOS).

* FlutterDefaultDartEntrypoint (or nil); this will default to `main()`. If it is not the app's
* main() function, that function must be decorated with `@pragma(vm:entry-point)` to ensure the
* method is not tree-shaken by the Dart compiler.
* @param libraryURI The URI of the Dart library which contains the entrypoint method. IF nil,
Copy link
Member

Choose a reason for hiding this comment

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

If

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER;

/** Initializes this FlutterViewController with the specified `FlutterEngineGroup`.
*
Copy link
Member

Choose a reason for hiding this comment

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

Describe the ownership of the resulting FlutterEngine from this API. e.g. if you pop this view controller, the engine is permanently gone?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ColdPaleLight
Copy link
Member

Thanks. I think this is helpful. We should keep parity between the platforms however. There should be an Android solution as well (though I acknowledge it'll be a lot more complicated than iOS).

The Android solution will be completed soon, and we will file a PR in the next few days :) .

@luckysmg
Copy link
Contributor Author

@xster
The Android Related PR is here:#29293

@luckysmg
Copy link
Contributor Author

Close this PR and later open a new PR about this feature

@luckysmg luckysmg closed this Nov 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants