GregoryConrad / mimir

⚡ Supercharged Flutter/Dart Database
https://pub.dev/packages/mimir
MIT License
120 stars 8 forks source link

Unable to get it to work on New Flutter application #226

Closed lohanidamodar closed 1 year ago

lohanidamodar commented 1 year ago

Hey I'm trying to use mimir in my Flutter project. I just added the following code and run on macOS

import 'package:flutter/material.dart';
import 'package:flutter_mimir/flutter_mimir.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Mimir.defaultInstance;
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(),
    );
  }
}

When I run, immediately get the following error

Exception has occurred.
FfiException (FfiException(RESULT_ERROR, Operation not permitted (os error 1), null))

The error is thrown in the getInstance function of the package

Future<MimirInstance> getInstance({
    required String path,
    required ExternalLibrary library,
  }) async {
    _milli ??= createWrapperImpl(library);
    await _milli!
        .ensureInstanceInitialized(instanceDir: path, tmpDir: tmpDir());
    return _instances.putIfAbsent(
      path,
      () => MimirInstanceImpl(path, _milli!),
    );
  }

Flutter Doctor

[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4 22F66 darwin-arm64, locale en-NP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
GregoryConrad commented 1 year ago

Hi 👋

I forgot to add macOS-specific setup info in the documentation. You need to disable macOS’ app sandbox in order to use Mimir at the moment (which also means you can’t submit to the Mac App Store, but can still distribute macOS applications yourself)

I’ll leave this open until I can fix the docs