Martin S
Martin S

Reputation: 463

Flutter Sqflite open database needs join method

I am currently trying to implement SQLite to my flutter project and I don't know how to open a database because the examples from SQLite seems to use an older version. In the examples, they use a string path in the openDatabase() method but in my version, the method needs a join(await getDatabasePath()). But when I input this in the method android studio editor shows red lines and the await keyword is not getting recognized. Can someone post an example that is working? I am using SQLite 1.1.5

Upvotes: 2

Views: 1932

Answers (2)

Quick learner
Quick learner

Reputation: 11467

In case you have not added this path plugin in your project make sure to add it in order to import the method properly.

Open pubspec file and import the path plugin like this

dependencies:
  path: ^1.8.3

Then import like this.

import 'package:path/path.dart';

Upvotes: 0

Martin S
Martin S

Reputation: 463

Thanks for the responses. It seems that there was a problem with my sqflite dependency. After running packages upgrade it works as expected.

Upvotes: 0

Related Questions