flutter_litert 0.1.2 copy "flutter_litert: ^0.1.2" to clipboard
flutter_litert: ^0.1.2 copied to clipboard

LiteRT (formerly TensorFlow Lite) Flutter plugin. Drop-in on-device ML inference with bundled native libraries for all platforms.

example/example.dart

// ignore_for_file: avoid_print
import 'dart:io';

import 'package:flutter_litert/flutter_litert.dart';

/// Example demonstrating basic TFLite model inference.
///
/// To run this example, you need a TFLite model file.
/// See the full examples in the example/ subdirectories for complete
/// Flutter applications.
void main() async {
  // Load a model from a file
  final modelFile = File('/path/to/model.tflite');
  final interpreter = Interpreter.fromFile(modelFile);

  // Get input and output tensor info
  print('Input tensors: ${interpreter.getInputTensors()}');
  print('Output tensors: ${interpreter.getOutputTensors()}');

  // Prepare input data (shape depends on your model)
  var input = [
    [1.0, 2.0, 3.0, 4.0]
  ];

  // Prepare output buffer (shape depends on your model)
  var output = List.filled(1, List.filled(2, 0.0));

  // Run inference
  interpreter.run(input, output);

  print('Output: $output');

  // Clean up
  interpreter.close();
}
0
likes
160
points
47
downloads

Publisher

verified publisherhugocornellier.com

Weekly Downloads

LiteRT (formerly TensorFlow Lite) Flutter plugin. Drop-in on-device ML inference with bundled native libraries for all platforms.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

ffi, flutter, path, plugin_platform_interface, quiver

More

Packages that depend on flutter_litert

Packages that implement flutter_litert