Skip to main content

flutter_lua_bridge_codegen_annotation 0.1.0 copy "flutter_lua_bridge_codegen_annotation: ^0.1.0" to clipboard
flutter_lua_bridge_codegen_annotation: ^0.1.0 copied to clipboard

Annotations shared by flutter_lua_bridge applications and its code generator.

example/example.md

Example #

Annotations describe a contract; flutter_lua_bridge_codegen generates the code on both sides from it. Import them through flutter_lua_bridge, which re-exports this package:

import 'package:flutter_lua_bridge/flutter_lua_bridge.dart';

part 'battle.g.dart';

enum Element { fire, water }

class Fighter {
  // Every field is a required constructor parameter, nullable ones too.
  const Fighter({
    required this.name,
    required this.attack,
    required this.element,
  });
  final String name;
  final int attack;
  final Element? element;
}

/// Implemented in Lua or Teal, called from Dart.
@LuaApi(module: 'battle', optimization: LuaOptimization.o3)
abstract class BattleApi {
  @LuaName('calculate_damage')
  int calculateDamage(Fighter attacker, Fighter defender);
}

/// Implemented in Dart, called from Lua.
@DartApi(module: 'host')
abstract class HostApi {
  void log(String message);
}

See the flutter_lua_bridge_codegen example for the generated code and the Teal implementation.

0
likes
160
points
106
downloads

Documentation

API reference

Publisher

verified publishereplab.top

Weekly Downloads

Annotations shared by flutter_lua_bridge applications and its code generator.

Repository (GitHub)
View/report issues

Topics

#lua #code-generation

License

MIT (license)

More

Packages that depend on flutter_lua_bridge_codegen_annotation