SQLite in Flutter

  Рет қаралды 9,319

FilledStacks

FilledStacks

Күн бұрын

Пікірлер: 120
@Ro_dolfoSilva
@Ro_dolfoSilva 4 жыл бұрын
This is so cool. I'll waiting for the serie about doing Offline First with: REST and SQLite and FilledStacks. Great Work Dane!
@FilledStacks
@FilledStacks 4 жыл бұрын
Thank you. I don't think there will be a series about that. I've shown how I do api, now sqlite so there's nothing left in that set of videos you asked for.
@steveandjodee
@steveandjodee 4 жыл бұрын
@@FilledStacks You could give an example of syncing between the SQLite db in the app and the API!
@FilledStacks
@FilledStacks 4 жыл бұрын
@@steveandjodee hey, I've seen this idea before. You don't actually sync between the two. Or at least in my experience of making an app offline. I store some of the data, that I won't want the user to request locally in the db. Then I'll always show that first and then fetch updated in the background and update again. There are waaaaay too many ways to do it and it all depends on the api capabilities. What you can get as a single request and what you can't get in addition what you want to be offline etc.
@ebelevics
@ebelevics 4 жыл бұрын
@@FilledStacks I would love to see tuts for building Offline First app. While I do agree it's an architecture choice, I haven't seen clear example of one of the architectures in Flutter using API and SQLite. Most problems occur when I have to sync with multiple devices or managing multiple offline state API requests when one of devices comes online after some offline time. And simply answering use Firebase is not an option.
@FilledStacks
@FilledStacks 4 жыл бұрын
@@ebelevics Luckily I've never had to build apps like that so I won't be able to make a video about that. It's not something that I think of often. The furthest scenario i've had to use local storage for is to ensure things are on screen while we fetch the real data. i don't manually do "Sync when connected" , I don't "Sync between devices" if the user has multiple accounts. That's all "naturally" taken care of by my startup logic. Get everything needed in my startup view, and then continue into the app when it's ready. So I basically always show fetched data first unless there's no connection. But then the apps I build won't work so I just tell them that and don't do much about it. Can't order from a food delivery service without internet :D so we can just not handle those scenarios because it'll bring no benefit to the customer or clients. And we do have "sync when connected" functionality, but it's all handled by firestore haha, so won't be able to make a video about that on SQL.
@MafazKhan1
@MafazKhan1 4 жыл бұрын
I definitely knew you would do it Thank u sooo much filled stacks
@FilledStacks
@FilledStacks 4 жыл бұрын
You're welcome :) Hopefully it's worth it.
@hurbes101
@hurbes101 4 жыл бұрын
I was waiting for this tutorial for so long. it was greatly informative and helpful, thank you. Please make a video on GraphQL with flutter is possible
@FilledStacks
@FilledStacks 4 жыл бұрын
I'm happy to hear that! and I'm happy that you got some value from it. I'm definitely doing GQL soon. Have to go into a bit of a crunch for a client app so we can deliver so I will probably be back in about 2 or three weeks only. I actually have a GQL implementation for this client so I can share that when I get back.
@hurbes101
@hurbes101 4 жыл бұрын
@@FilledStacks I'll be eagerly waiting for it :)
@FilledStacks
@FilledStacks 4 жыл бұрын
@@hurbes101 :D
@gauravidesigns
@gauravidesigns 4 жыл бұрын
Your tutorials are best and consise
@FilledStacks
@FilledStacks 4 жыл бұрын
Thank you. I try my best to keep things easy to understand
@sheshankgupta4993
@sheshankgupta4993 4 жыл бұрын
Dane my man you absolutely lifted me from scratch in flutter development... Cannot thank you enough. And what the hell is this Riverpod thing. Would love to see your views on it.
@FilledStacks
@FilledStacks 4 жыл бұрын
You're very welcome. It's my pleasure to share the knowledge. I haven't used it yet. I will take a look at it and see how much benefit we can get from it.
@ferhataksoy1851
@ferhataksoy1851 4 жыл бұрын
This is the video that i am waiting for thank you so much.
@FilledStacks
@FilledStacks 4 жыл бұрын
You're welcome! I hope it's worth the wait.
@ferhataksoy1851
@ferhataksoy1851 4 жыл бұрын
@@FilledStacks Definitely worth it.
@h3w45
@h3w45 4 жыл бұрын
Thanks for this. Also covering Moor or Hive will be great.
@FilledStacks
@FilledStacks 4 жыл бұрын
Resocoder has a good series on moor so I don't think there's anything that I can add. If I ever use hive in production I will share what I learned, at the moment i haven't so I don't have anything to share about it.
@h3w45
@h3w45 4 жыл бұрын
@@FilledStacks yes you are totally right, thank you.
@FilledStacks
@FilledStacks 4 жыл бұрын
@@h3w45 😄
@workflop4117
@workflop4117 4 жыл бұрын
I love your content always fantastic quality
@FilledStacks
@FilledStacks 4 жыл бұрын
I really appreciate the kind words and leaving the comment. Thank you
@workflop4117
@workflop4117 4 жыл бұрын
@@FilledStacks Thanks to you for sharing such amazing content
@FilledStacks
@FilledStacks 4 жыл бұрын
@@workflop4117 😊
@_rubs
@_rubs 4 жыл бұрын
Pretty nice information here. Can I suggest you to follow up this SQL series on how to back up the DB to either google drive or even better dropbox, and restore the DB back again to a simulated brand new device?.
@FilledStacks
@FilledStacks 4 жыл бұрын
Thank you. I've never done that, the way I handle that is by storing all the information on the server. The database functionality is purely to provide offline capabilities when there's no connection so we show something and not nothing. I've never done a DB backup. Basically on start I get whatever info I need from the api and keep it locally.
@isyedaliraza
@isyedaliraza 4 жыл бұрын
I really appreciate your work. Keep it up bro. Also do a tutorial on localization. Thanks for the knowledge you are sharing ❤️
@FilledStacks
@FilledStacks 4 жыл бұрын
Hey Hey, I planned to do one but never got around too it. There's quite a lot of functionality to go through and to add into my package before I can do that. But it's on the list of videos to make.
@isyedaliraza
@isyedaliraza 4 жыл бұрын
Thanks, I'm looking forward to that.
@FilledStacks
@FilledStacks 4 жыл бұрын
@@isyedaliraza Hopefully one day soon
@cautaro
@cautaro 4 жыл бұрын
Any experience with using Floor? What are your thoughts on it?
@FilledStacks
@FilledStacks 4 жыл бұрын
None, I've never used it. The furthest I got was watch the @resocoder video on it to see what it's about. But I've never used it in production.
@cautaro
@cautaro 4 жыл бұрын
Great video again! How would you organize multiple models in the database_service file? Would you extract the CRUD functions to a file for each model?
@FilledStacks
@FilledStacks 4 жыл бұрын
thank you! I'm a bit confused by the term "Multiple models in a database_service file" the data models I usually keep in separate files. When there are multiple actions for each model I do split them up at some point but I've found it more difficult to maintain in the long run that way. Unless each of them has access to the same database, but I like having a unified api for all the DB actions. So that's a personal thing on my side. You could split the actions for ORders and posts into separate repositories if that feels better for you.
@cautaro
@cautaro 4 жыл бұрын
@@FilledStacks In the example above you have only one model - Todo. The methods ( getTodos, addTodo etc.) that manipulate this model are in DatabaseService. In case that the app has multiple models, where do you place all the methods specific to these models? Still in the DatabaseService? For an app with 10 models and 5 methods each, it can be a file with 50 methods. I'm trying to get my head around how you organize such a scenario. Thank you
@FilledStacks
@FilledStacks 3 жыл бұрын
@@cautaro I see, i've done both. Splitting the models between multiple classes and keeping it in 1. I like keeping it in 1 more than splitting it into 10 different classes. makes the unit testing easier and the maintenance as well. It might be how i implemented it but I still liked having 1 file more for the maintenance.
@pierremarais7669
@pierremarais7669 3 жыл бұрын
Hi, I have a sqlite database I want to 'secure' it using sqlcipher, is this the correct way, have you ever seen an example of using this, thanks Pierre
@FilledStacks
@FilledStacks 3 жыл бұрын
Hi Pierre, I have not seen an example of this and I also have never used sqlcipher. I've never stored sensitive info locally so I don't ever have the requirement for a secure db.
@LikeLuluLikeLulia
@LikeLuluLikeLulia 3 жыл бұрын
Hi, how to create multi-tables with foreign key with this method? and in openDatabse, there isn't a path, only a datebase name, do we need a path too? thank you!
@FilledStacks
@FilledStacks 3 жыл бұрын
Hi, that would all be done in your SQL files. However you would do that in normal sql you'd do it the same way here, if that's supported in sqlite. And the path is the name of the DB.
@jaspreetkaur-mo2dr
@jaspreetkaur-mo2dr 4 жыл бұрын
Awesome man, Another again content. Thanks, Man
@FilledStacks
@FilledStacks 4 жыл бұрын
Thanks! I appreciate it :)
@NabilDesignz
@NabilDesignz 4 жыл бұрын
Can you please do Wysiwyg ? How to render properly data from wysiwyg stored in firestore? I mean from wysiwyg web to firestore to data displayed nicely in flutter. Thanks 👏
@FilledStacks
@FilledStacks 3 жыл бұрын
Hey, I have no idea what that is so I doubt I'll be able to make a video about it.
@ajnaf7277
@ajnaf7277 3 жыл бұрын
have you considered using the hive package it saves much boilerplate and it is fast
@FilledStacks
@FilledStacks 3 жыл бұрын
I have but the query functionality is limited. I needed the query relations for the data that was being stored
@ajnaf7277
@ajnaf7277 3 жыл бұрын
@@FilledStacks i had the same problem but i solved it by adding adapters to each model it should work fine
@FilledStacks
@FilledStacks 3 жыл бұрын
@@ajnaf7277 Thanks for that info. I'll look into that again when we get around to our next project. I Appreciate you sharing that.
@isaacadariku
@isaacadariku 4 жыл бұрын
💙💙💙 thanks FilledStack
@FilledStacks
@FilledStacks 4 жыл бұрын
You're welcome. Thanks for watching.
@JuanPerez-vv5lk
@JuanPerez-vv5lk 3 жыл бұрын
is this technique valid as of today july 2021 ?
@FilledStacks
@FilledStacks 3 жыл бұрын
Yes. still valid. we use it in production.
@oualisalaheddine5587
@oualisalaheddine5587 4 жыл бұрын
Merci Monsieur.
@FilledStacks
@FilledStacks 4 жыл бұрын
:D
@rishabhsharma3821
@rishabhsharma3821 4 жыл бұрын
Thanks I was working with this package , can we also save the state of the widget like for example a process bar
@FilledStacks
@FilledStacks 4 жыл бұрын
I wouldn't recommend that. I'd rather use a no sql db for that like hive so that you don't have to update your schema everytime you want to save data from a different widget.
@rishabhsharma3821
@rishabhsharma3821 4 жыл бұрын
I was trying Hive but Idk what’s wrong with it , the package is not stable though I have worked with before but now it’s not working
@rishabhsharma3821
@rishabhsharma3821 4 жыл бұрын
Can you create a discord channel where you can add people working in flutter so that they help each other out
@FilledStacks
@FilledStacks 4 жыл бұрын
@@rishabhsharma3821 Yeah we have a channel on Slack join.slack.com/t/filledstacks/shared_invite/zt-hqvqnd50-trS3YfEsL~2LQXfi9XjFBw I don't like discord because everthing is confusing and you can't follow a conversation. Slack has threads so it works out better.
@wickedgummybear3104
@wickedgummybear3104 4 жыл бұрын
@@rishabhsharma3821 I was using Hive for a while, but also struggeling. At some point it was not doing something which it was supposed to do and didnt give an error either. SQL is a bit too much power for my needs at the moment so I switched to Sembast. It seems to do the trick.
@RioM8z
@RioM8z 4 жыл бұрын
Unfortunately is not possible to use SQLite in Flutter for web.
@FilledStacks
@FilledStacks 4 жыл бұрын
If I had to choose a db to use I wouldn't go with SQLite for local storage. Something without schema management would be my first choice. If I had to do advanced queries then it would have to be sqlite other than that you can do with a noSql db that has browser support.
@hammadpervez4568
@hammadpervez4568 4 жыл бұрын
I'm having a issue with my flutter code, Where can I ask ?
@FilledStacks
@FilledStacks 4 жыл бұрын
You can join our slack channel and ask there join.slack.com/t/filledstacks/shared_invite/zt-hqvqnd50-trS3YfEsL~2LQXfi9XjFBw
@beyondbuks4828
@beyondbuks4828 4 жыл бұрын
Next video suggestion how to manage onboarding screens(the screens should only be shown when the user first installed the app)
@FilledStacks
@FilledStacks 4 жыл бұрын
Thanks for the suggestion. I've seen quite a few videos on that. You just use shared preferences, at the end of onboarding you set a value to true. If it;s false when you start the app you show the on boarding. If it's not you skip it.
@jaineelmamtora8208
@jaineelmamtora8208 3 жыл бұрын
Hey, my database is getting deleted whenever I hot restart or also when the app is removed from recent apps and opened again. Any idea how to solve this?
@FilledStacks
@FilledStacks 3 жыл бұрын
Hey, I don't know why that would be happening. I use the sql_migration_service and it solved that for me.
@jaineelmamtora8208
@jaineelmamtora8208 3 жыл бұрын
@@FilledStacks I got the solution, thanks for replying though!
@FilledStacks
@FilledStacks 3 жыл бұрын
@@jaineelmamtora8208 Awesome. What did you have to do?
@jaineelmamtora8208
@jaineelmamtora8208 3 жыл бұрын
@@FilledStacks Well, I was not querying the database properly.
@FilledStacks
@FilledStacks 3 жыл бұрын
@@jaineelmamtora8208 aaaaaah, that can happen. I'm a SQL noob and that has definitely happened to me before.
@beyondbuks4828
@beyondbuks4828 4 жыл бұрын
Thank you so much
@FilledStacks
@FilledStacks 4 жыл бұрын
It's my pleasure to share it! Thanks for watching.
@attafriski5901
@attafriski5901 4 жыл бұрын
Thank you Dane.
@FilledStacks
@FilledStacks 4 жыл бұрын
It's my pleasure.
@wickedgummybear3104
@wickedgummybear3104 4 жыл бұрын
Damn, so many things to dissect here... personally never used FutureViewModel. Going to look into that now.. very nice Tutorial! Thank you!
@FilledStacks
@FilledStacks 4 жыл бұрын
Thanks! It's pretty basic, if your view DEPENDS on data returned by a Future then use the future viewmodel. Give the future to the futureToRun function and it'll run the future, set the view to busy until the data is returned. When the data comes back it sets the data property on the model and fires onData incase you want to do something when the data is returned. It also catches the errors for you and sets it to the error object. it also fires the onError function in case you want to do something when the error happens like show a dialog, etc. Very useful. It removes quite a bit of boilerplate.
@wickedgummybear3104
@wickedgummybear3104 4 жыл бұрын
@@FilledStacks I see, I think I'll try to refactor a bit of my app to see how it goes when I'm done with my other stuff.Thank you for this.. On an unrelated note, I was updating my packages and got this error: Because "app" depends on stacked_themes ^0.2.0 which depends on get_it ^4.0.4, get_it ^4.0.4 is required. If you have the time, can you update your package requirements?
@FilledStacks
@FilledStacks 4 жыл бұрын
@@wickedgummybear3104 I can definitely update and push that.
@wickedgummybear3104
@wickedgummybear3104 4 жыл бұрын
@@FilledStacks It's all working perfectly fine as it is, but I just always feel a bit better when everything is tidy and up to date hahaha. Thank you! No hurries though!
@FilledStacks
@FilledStacks 4 жыл бұрын
@@wickedgummybear3104 haha, you and me both :D :D It's a much better feeling and migration process as well when you do all the incremental updates along the way instead of a massive refactor months down the line. We think the same!
@NIKHIL27B
@NIKHIL27B 4 жыл бұрын
You are amazing man ♥
@FilledStacks
@FilledStacks 4 жыл бұрын
Thanks man. Much appreciated.
@abraiyan7984
@abraiyan7984 4 жыл бұрын
Can we use Moor here? Are there any downsides of using Moor?
@FilledStacks
@FilledStacks 4 жыл бұрын
yes you can. I don't know of any downsides, haven't used it before.
@abraiyan7984
@abraiyan7984 4 жыл бұрын
@@FilledStacks you should check it
@FilledStacks
@FilledStacks 4 жыл бұрын
@@abraiyan7984 I don't need SQLite outside of the basic functionality and I needed a bit more manual control over models and mapping of the data. But i have seen the reso coder series on it.
@abraiyan7984
@abraiyan7984 4 жыл бұрын
@@FilledStacks Thanks, man. It will be great to know what kind of database you use for your projects. And I have a request. Make a video on the NoSQL database or a series of videos.
@FilledStacks
@FilledStacks 4 жыл бұрын
@@abraiyan7984 All the code I share comes from production solutions. So at the moment we're using sqlite. The only NoSql db we use is through firestore which we're using for 2 apps at the moment, another 2 a few months ago. I'd highly recommend fireship.io instead of my content for no sql db content. Jeff has a way better set of knowledge around it. I only learn what I need to to overcome a problem at hand.
@emmanuelsonzico5997
@emmanuelsonzico5997 4 жыл бұрын
Thanks dane! 🙌
@FilledStacks
@FilledStacks 4 жыл бұрын
It's my pleasure!
@Moali11
@Moali11 4 жыл бұрын
Great video, could you please share the source code for this tutorial?
@FilledStacks
@FilledStacks 4 жыл бұрын
Thank you. It's with all the other tutorials at github.com/filledstacks/flutter-tutorials
@nero9061
@nero9061 3 жыл бұрын
Please make a video about handle API and exception and other concept related. I get stuck with this so long :(((
@FilledStacks
@FilledStacks 3 жыл бұрын
Hey, I handle mine the normal way, I surround the call with a try catch and print out the errors in the catch statement.
@nero9061
@nero9061 3 жыл бұрын
many problem around they such as many different responses corresponding to many status codes, how catch it and print error message inside different json type ... :((
@FilledStacks
@FilledStacks 3 жыл бұрын
@@nero9061 I check for certain status codes and then handle it according to how my app should handle that based on what it means coming from the api. I just add if statements and then do what needs to be done per response code. I have one function that handles all the actual requests so I can handle the response codes in one place and use that function for every endpoint we have.
@nero9061
@nero9061 3 жыл бұрын
@@FilledStacks but when i handle in one function actually making request, with one responsebody, I have to call fromJson function in different classes to decode to have actual message to show in dialog, and in every classes i said, the model class is totally different. So I can't return the actual message I want to show from where making request to the view model to show dialog or something like that. Still so confused ...
@FilledStacks
@FilledStacks 3 жыл бұрын
@@nero9061 Sorry man, i have no idea what you mean. You can just return your response in the way you want it. If you're handling the same response differently in many places that should work fine as well.
@billywatsikenyere6656
@billywatsikenyere6656 3 жыл бұрын
you good man
@FilledStacks
@FilledStacks 3 жыл бұрын
Thank you! Much appreciated.
@RandalLSchwartz
@RandalLSchwartz 4 жыл бұрын
It's pronounced "ess cue light" according to Richard Hipp, and "ess cue ell" for the abstract language (and *never* "sequel" yuck), regardless of how you've been hearing it all these years. Monty Widenius insists on "my ess cue ell" for the app/framework later named Maria, and I've heard "ess cue flight" for the Flutter package.
@FilledStacks
@FilledStacks 4 жыл бұрын
Thanks, i do always struggle to find the correct ways to pronounce things. I like using the SQL naming SeeQuel Lite. But now I know it's wrong haha.
@vicyoslinuxofficial2607
@vicyoslinuxofficial2607 3 жыл бұрын
Bruh, you rock!!!!!! Thank you so much for this freaking good video! Bruh, I've gotta question: Is your website: "www.filledstacks.com" backend and front-end made with flutter for web? Thanks.
@FilledStacks
@FilledStacks 3 жыл бұрын
Thanks!! There's actually no backend for FilledStacks. It uses all locally hosted data. The tutorials are generated from markdown files and stored in a local graph ql database. I use Gridsome for my website, it's built ontop of VueJs.
@pradeep422
@pradeep422 4 жыл бұрын
lol u still on Earth thought u moved to Mars heheh...
@FilledStacks
@FilledStacks 4 жыл бұрын
haha! Nooo, I love earth too much. :)
@joaovictor16_22
@joaovictor16_22 4 жыл бұрын
Reso is awesome hahahaha it's true
@FilledStacks
@FilledStacks 4 жыл бұрын
very true :)
Flutter Theme Manager for Multiple Themes
8:55
FilledStacks
Рет қаралды 21 М.
Ouch.. 🤕⚽️
00:25
Celine Dept
Рет қаралды 20 МЛН
Я сделала самое маленькое в мире мороженое!
00:43
Кушать Хочу
Рет қаралды 4,9 МЛН
#Google's Flutter Tutorial - SQLite CRUD Operations (coderzheaven.com)
20:10
Using SQLite in Flutter
35:52
Garrett Love
Рет қаралды 47 М.
Next.js is hiding something...
29:48
Theo - t3․gg
Рет қаралды 27 М.
Flutter Sqflite | Easiest Tutorial | Flutter Tutorial for beginners
40:42
The Growing Developer
Рет қаралды 69 М.
Complete Flutter Architecture using Provider and Stacked
22:59
FilledStacks
Рет қаралды 91 М.
PostgreSQL CRASH COURSE - Learn PostgreSQL in 2024
50:26
Top 16 Dart Tips and Tricks Every Flutter Developer Should Know
11:44
Andrea Bizzotto
Рет қаралды 59 М.
The Best Flutter Responsive UI Setup
13:11
FilledStacks
Рет қаралды 87 М.
How to Touch anything in Flutter!
1:30
FilledStacks
Рет қаралды 8 М.
Learn Flutter Hooks and Maximize Your Code Reuse
10:36
Robert Brunhage
Рет қаралды 61 М.
Ouch.. 🤕⚽️
00:25
Celine Dept
Рет қаралды 20 МЛН