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

Read-only inspection APIs for Preference databases and VM service tooling.

example/preference_inspector_example.dart

import 'dart:convert';
import 'dart:typed_data';

import 'package:preference_engine/preference_engine.dart';
import 'package:preference_inspector/preference_inspector.dart';

/// Inspects JSON records exposed by an active Preference engine.
Future<void> main() async {
  final backend = MemoryBackend();
  await backend.open(const MemoryLocation('inspector-example'));
  await backend.commit(
    BackendCommit([
      BackendPut(
        'tasks/1',
        Uint8List.fromList(utf8.encode(jsonEncode({'title': 'Calibrate'}))),
      ),
    ]),
  );

  final inspector = PreferenceInspector.connect(
    EngineInspectionProvider(backend, databaseId: 'inspector-example'),
  );
  final collections = await inspector.getCollections();
  final record = await inspector.inspectRecord('tasks', 'tasks/1');
  print('${collections.single.name}: ${record?.decodedValue}');

  await backend.close();
}
0
likes
160
points
143
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Read-only inspection APIs for Preference databases and VM service tooling.

Homepage

Topics

#database #debugging #dart

License

Apache-2.0 (license)

Dependencies

preference_core, preference_engine, preference_protocol

More

Packages that depend on preference_inspector