flutter_reference 0.0.5 copy "flutter_reference: ^0.0.5" to clipboard
flutter_reference: ^0.0.5 copied to clipboard

A simple Flutter plugin to keep object in memory on native code, while pass a string reference to Flutter code.

Flutter Reference #

Pub Pub Score License

A simple Flutter plugin to keep object in memory on native code, while pass a string reference to Flutter code.

Usefull to interact with native objects without serializing its content.

Usage #

From native side, after creating a instance, return it's reference to Flutter using:

val instance = Orange()
val ref = References.add(instance)

To retrieve a instance on native side, use:

val instance = References.get<Orange>(ref)

On Flutter side, always wrap the reference string on Reference class, since this class has capability to handle garbage collection.

Future<Reference> create() {
  return channel.invokeMethod("create").then((value) => Reference(value));
  // or
  return channel.invokeMethodReference("create", (id) => Reference(id));
}

Also you can create your own class who extends Reference

class Fruit extends Reference {
  Fruit(super.id);
}

License #

CC BY-ND 4.0

  • You can use and re-dist freely.
  • You can also modify, but only for yourself.
  • You can use it as a part of your project, but without modifications in this project.
1
likes
135
pub points
61%
popularity

Publisher

verified publisherdig.dev.br

A simple Flutter plugin to keep object in memory on native code, while pass a string reference to Flutter code.

Repository (GitHub)
View/report issues

Documentation

API reference

License

CC-BY-ND-4.0 (LICENSE)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_reference