'Flutter share native objects between plugins
I am working on a couple plugins for streaming and recording video. In Android land it is generally not possible to have two things access the camera simultaneously.
The obvious solution is to merge the two plugins into one that marshals/shares the resource.
This got me thinking. Is there any way to share native objects between plugins? I cannot find any documentation or resources on this.
Does anyone have a suggestion on how to achieve this?
Solution 1:[1]
I've been doing similar stuff - not with video but with raw data, and it is possible. There are two major approaches:
- Share data between the packages via flutter medium - method + event channels with the proper implementation in all plugins.
- Since you would have to implement a lot of boilerplate either way in both ios and android platforms, you as well may implement all the sharing directly in the native code. After all, you have access to all the plugins' native code in the native part of your flutter app. Just channel the data there correctly without including flutter at all(well, not at all - in the end, some trigger methods/events should exist either way).
I went down the second path, and it was not that hard to do. I'm not sure about your use case, but sharing the video stream between several end recipients is possible, so it should also be possible in the flutter app.
Solution 2:[2]
Check source.SupportsSorting, more likely it returns false. To allow sorting look at SortableBindingList.
- Load your list<Person> into a SortableBindingList e.g.
_personList - Assign
source.DataSource to the SortableBindingList - Set the DataGridView.DataSource to
source
To obtain a data current Person via the current row in the DataGridView.
Person person = _personList[source.Position];
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pavlo Ostasha |
| Solution 2 | Karen Payne |
