Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 2.22 KB

File metadata and controls

64 lines (48 loc) · 2.22 KB

A package that wraps Everything SDK API calls using FFI to make them accessible to Dart code.

Features

Getting started

dart pub add everything_search_engine

import 'package:everything_search_engine/everything.dart';

/// `await Everything.ensureInited()` must be called before `Everything.fromDefaultLibraryPath()` unless you use your own dll library
await Everything.ensureInited();
Everything everything = Everything.fromDefaultLibraryPath();

add flutter asset in pubspec.yaml if you are using flutter or flutter_test

flutter:
  assets:
    - packages/everything_search_engine/src/dll/Everything64.dll

Usage

import 'package:everything_search_engine/everything_search_engine.dart';

Future<void> main() async {
  /// `await Everything.ensureInited()` must be called before `Everything.fromDefaultLibraryPath()` unless you use your own dll library
  await Everything.ensureInited();

  final everything = Everything.fromDefaultLibraryPath();

  final results = everything.runQuery(
    const Query(
      search: r'^pubspec\.yaml$',
      isMatchPath: false,
      isRegex: true,
      // isMatchCase: false,
      // isMatchWholeWord: false,
      requestFlags: RequestFlags(
        dateCreated: true,
      ),
      sort: EverythingSort.dateCreatedDescending,
      max: 20,
      offset: 0,
    ),
  );
  // ignore: avoid_print
  print(results.items.join('\n'));
}

Additional information