Coder Social home page Coder Social logo

Flutter web support about brick HOT 2 CLOSED

getdutchie avatar getdutchie commented on August 15, 2024
Flutter web support

from brick.

Comments (2)

tshedor avatar tshedor commented on August 15, 2024

Hey @Jeremywhiteley there aren't current plans to support SQLite on the web until there's a suitable solution in sqflite, which has a long running thread about this. However, there looks like some very recent experimental work being done on this repo. If you want to give that a go, you just need to define the database factory:

dependencies:
  universal_platform: ^0.1.3
  sqflite_web:
    git:
      path: [email protected]:deakjahn/sqflite_web.git

And then in your Repository (untested code):

import 'package:sqflite_common/sqlite_api.dart';
import 'package:sqflite_web/sqflite_web.dart';
import 'package:universal_platform/universal_platform.dart'; // necessary for persistence to disk on Android/iOS

import 'brick.g.dart'; // of course, relative to your repository

MyOfflineFirstRepository(
  sqliteProvider: SqliteProvider(
    UniversalPlatform.isWeb ? inMemoryDatabasePath : 'my_custom_database.sqlite',
    databaseFactory: UniversalPlatform.isWeb ? databaseFactoryWeb : null,
    modelDictionary: sqliteModelDictionary,
  )
)

I haven't read that discussion too closely, but there's a fair chance that your DB won't be persisted between sessions or tabs on the web. I'd also recommend giving feedback as you uncover bugs to that sqflite_web repo.

from brick.

rodydavis avatar rodydavis commented on August 15, 2024

Just wanted to though this out there and curious if it was considered.

simolus3/drift#2382

Chrome is also remove WebSQL in favor of SQLite on the web:

https://developer.chrome.com/blog/sqlite-wasm-in-the-browser-backed-by-the-origin-private-file-system/

from brick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.