2

I built my database through SQLITE. I read the values from the database and created my page. Then I realized one fact. IOS and ANDROID have different paths in which DATABASE is stored.

It is my database code :

initDB() async{
    Directory dbDir = await getApplicationDocumentsDirectory();
    String path = join(dbDir.path, "social2.db");
    print('init...');
    print(path);
    return await openDatabase(
      path,
      version: 1,
      onOpen: (db) {},
      onCreate: (Database db, int version) async{
        await db.execute('''
        CREATE TABLE $tableName(
        id INTEGER PRIMARY KEY,
        email TEXT,
        password TEXT,
        name TEXT,
        intro TEXT,
        age TEXT,
        image0 BLOB,
        image1 BLOB,
        image2 BLOB,
        image3 BLOB,
        image4 BLOB,
        image5 BLOB,
        vote INTEGER,
        location TEXT) ''');
      },
    );
  }

How can I use my database normally?

4
  • Those are two different devices right? iOS and Android has different file structure. It shouldn't matter for the Apps. Commented Oct 15, 2019 at 10:47
  • @ChennaReddy So what do I do to get you to use the same DB? Commented Oct 15, 2019 at 13:51
  • I didn't get your question, what do you mean by same DB? It's a different DB on different device right? It might have different paths on iOS and Android, but that can't be a problem. Commented Oct 15, 2019 at 13:54
  • @ChennaReddy Strangely, my app works well because the IOS DB is working properly, but the ANDROID does not work.... :( Commented Oct 15, 2019 at 13:57

1 Answer 1

1

If you are using path_provider plugin then it supports both iOS and Android as stated in its documentation

A Flutter plugin for finding commonly used locations on the filesystem. Supports iOS and Android.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.