Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple flutters sample android #677
Multiple flutters sample android #677
Changes from all commits
3aeb60e
be28a34
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea. Android studio added it, maybe when I was trying to solve my signing issue for release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want to do the same thing as iOS here? (e.g. cull the dead references)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though for fwiw, if you use the engine cache, then things will never be gc'ed under the weak reference. I'd probably just stick to explicit destructions which make things more manageable in the JVM anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm doing the same thing I'm doing on iOS. Skip on notify, cull on removeObserver.
This should handle anybody that is being GC'd or manually deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#762 is probably this. The
i
needs to account for the number of occurrences of DoubleFlutterActivity too. Otherwise, the engine cache index 0 and 1 get overwritten over and over again (and can't pop back).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do this for iOS too for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already is happening, but in a slightly different way. On iOS SingleFlutterViewController bundles the bindings with itself so it's not necessary. I wouldn't want to add a concept that isn't necessary. I don't think that would make the sample more clear.
A more similar approach would be to have Fragment that bundles the communication with a FlutterFragment, then have SigqleFlutterActivity and DoubleFlutterActivity embed that Fragment. Unfortunately for me, converting an Activity to a Fragment isn't trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, I just meant generally where the platform channel handlers sit between the 2 platforms if someone was looking for them in each of the platforms. If they need to be in different sounding files, maybe add a comment cross-referencing the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah that's where engines is lazy built first. I think this is an example of the init lifecycle not leaking outside the class and being more deterministic using lateinit vs lazy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I switched engines to lateinit. If this was code that I was writing for me I would prefer lazy evals, but having a lazy eval for a variable is a bit much for sample code.
I kept lazy for the engine bindings because they are actually used before onCreate in the case of SingleFlutterActivity, so the code is cleaner this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG