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.

example/example.md

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_reference/flutter_reference.dart';

class Fruit extends Reference {
  @protected
  Fruit(super.id);

  static Future<Fruit> create() {
    return _FruitChannel.create();
  }

  Future<String> name() {
    return _FruitChannel.name(this);
  }
}

class _FruitChannel {
  static const channel = MethodChannel("example_plugin");

  static Future<Fruit> create() {
    return channel.invokeMethodReference("create", (id) => Fruit(id));
  }

  static Future<String> name(final Fruit fruit) {
    return channel
        .invokeMethod("name", fruit.id)
        .then((value) => value.toString());
  }
}
1
likes
155
points
99
downloads

Publisher

verified publisherdig.dev.br

Weekly Downloads

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

Repository (GitHub)

Documentation

API reference

License

CC-BY-ND-4.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_reference