작성
·
209
0
안녕하세요.
Unique Constraint 테스트하기 강의에서 izar database를 main 함수 내에서 여는 코드에서 에러가 나서 진행이 되지 않고 있습니다,,
main.dart
import 'package:dusty_dust/model/stat_model.dart';
import 'package:dusty_dust/screen/home_screen.dart';
import 'package:flutter/material.dart';
import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart';
void main() async {
//main 함수에서 runApp말고 다른 거 실행하려면 이걸 적어줘야함.
WidgetsFlutterBinding.ensureInitialized();
final dir = await getApplicationDocumentsDirectory();
final isar = await Isar.open(
[StatModelSchema],
directory: dir.path,
);
runApp(
MaterialApp(
theme: ThemeData(
fontFamily: 'sunflower'
),
home: HomeScreen(),
));
}
pubspec.yaml
cupertino_icons: ^1.0.2
dio: ^5.4.3+1
isar: ^3.1.0+1
isar_flutter_libs: ^3.1.0+1
path_provider: ^2.1.2
isar_generator: ^3.1.0+1
Error Message
E/flutter ( 364): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
E/flutter ( 364): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7)
E/flutter ( 364): <asynchronous suspension>
E/flutter ( 364): #1 getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121:24)
E/flutter ( 364): <asynchronous suspension>
E/flutter ( 364): #2 main (package:dusty_dust/main.dart:11:15)
E/flutter ( 364): <asynchronous suspension>
E/flutter ( 364):