Skip to main content

knowa_flutter_bindings 2.2.0 copy "knowa_flutter_bindings: ^2.2.0" to clipboard
knowa_flutter_bindings: ^2.2.0 copied to clipboard

The Flutter classes a Knowa code-push patch can use, bound for Knowa's patch runtime. You do not depend on it directly: knowa_sdk does.

example/example.dart

// Builds a widget from a patch using the Flutter bindings.
//
// Patches are normally compiled from Dart source by the Knowa CLI, and
// knowa_sdk registers these bindings for you. This example builds the
// compiled form of the following patch by hand:
//
//   @KnowaOverride('home.title')
//   Widget title() => const Text('Hello from a patch');
import 'package:flutter/material.dart';
import 'package:knowa_flutter_bindings/knowa_flutter_bindings.dart';
import 'package:knowa_kernel/knowa_kernel.dart';

void main() {
  final interpreter = KInterpreter(
    const KModule(
      functions: {
        'title': KFunction(
          name: 'title',
          params: [],
          frameSize: 0,
          body: KReturn(
            KConstruct('Text', '', KArgs([KLiteral('Hello from a patch')])),
          ),
        ),
      },
      classes: {},
      overrides: {'home.title': 'title'},
    ),
    bridges: knowaFlutterBridges,
  );

  final title = interpreter.callOverride('home.title') as Widget;
  runApp(MaterialApp(home: Scaffold(body: Center(child: title))));
}
0
likes
150
points
541
downloads

Documentation

API reference

Publisher

verified publisherknowalabs.com

Weekly Downloads

The Flutter classes a Knowa code-push patch can use, bound for Knowa's patch runtime. You do not depend on it directly: knowa_sdk does.

Homepage

Topics

#code-push #ota-updates #flutter

License

BSD-3-Clause (license)

Dependencies

flutter, knowa_kernel, vector_math

More

Packages that depend on knowa_flutter_bindings