flutter_gemma_diagnostics 0.1.1 copy "flutter_gemma_diagnostics: ^0.1.1" to clipboard
flutter_gemma_diagnostics: ^0.1.1 copied to clipboard

discontinued
PlatformAndroidiOS

Moved to flutter_edge_ai_diagnostics. This is the final release under the name flutter_gemma_diagnostics; new versions ship as flutter_edge_ai_diagnostics, part of Flutter Edge AI.

example/example.dart

// ignore_for_file: avoid_print
import 'package:flutter_gemma_diagnostics/flutter_gemma_diagnostics.dart';

/// Measures what an operation costs in memory the OS enforces.
Future<void> main() async {
  if (!FlutterGemmaDiagnostics.isSupported) {
    print('Memory diagnostics run on Android and iOS only.');
    return;
  }

  final before = await FlutterGemmaDiagnostics.memorySnapshot();
  // ... load a model or run a generation here ...
  final after = await FlutterGemmaDiagnostics.memorySnapshot();

  final anonBefore = before.anonymousBytes;
  final anonAfter = after.anonymousBytes;
  if (anonBefore != null && anonAfter != null) {
    final mib = (anonAfter - anonBefore) / (1024 * 1024);
    print('Anonymous footprint changed by ${mib.toStringAsFixed(1)} MiB');
  }
  print('Available now: ${after.availableBytes ?? 'unknown'} bytes');
}
1
likes
150
points
64
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Moved to flutter_edge_ai_diagnostics. This is the final release under the name flutter_gemma_diagnostics; new versions ship as flutter_edge_ai_diagnostics, part of Flutter Edge AI.

Topics

#memory #diagnostics #gemma #on-device

License

MIT (license)

Dependencies

ffi, flutter, meta

More

Packages that depend on flutter_gemma_diagnostics