I had been looking for using mongo db and flutter together and even watched the 3 vids on mongo dart package and also this one am watching thanks Man U are priceless
This is the best course I've viewed on TH-cam. Great job. I did have a problem running the code. Works fine in MS Edge, but on my mobile, or in Chrome i get this error: Syncing files to device I3312... Restarted application in 2,397ms. D/libc-netbsd( 6087): getaddrinfo: get result from proxy gai_error = 0 E/flutter ( 6087): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: DioError [DioErrorType.other]: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 51944 E/flutter ( 6087): #0 DioMixin.assureDioError (package:dio/src/dio_mixin.dart:819:20)
This is really good brother, please consider teaching how to Realm for offline first approach in a project; like a notes taking app ( user can create a note even when offline and later sync with the cloud,) Subed
OMG, this tutorial is great. Since I am still a Flutter beginner it blew my mind a little bit :). Do you also have some Flutter tuts for beginners going? Cheers
More videos bro .. pls next time show how to set flutter to make use of the device default font instead of flutter font. And if the device don't is changed by the user then the app fonts changes too. I'll be grateful. Thanks for this btw
i've learned a ton from the way you describe things, very clear in your teaching, do you have a flutter course yet? or is that part of the dart course you have on creativebracket?
Thanks for the video - sadly when I look at the lack of popularity of packages like serv and still no real official module for mongodb... I am going SQL instead. Liked the video though!
Sure, whichever works for you. The mongo_dart package is still maintained and an official mongo dart realm package is in the works github.com/realm/realm-object-server/issues/55#issuecomment-722600281 I'd look at the shelf package by the Dart team for setting up servers, and has null-safety enabled
hi, how can i solve? ERROR: Unhandled exception: MongoDB ConnectionException: connection closed: The socket connection has been reset by peer. Possible causes: - Trying to connect to an ssl/tls encrypted database without specifiyng either the query parm tls=true or the secure=true parameter in db.open() - Others
How did you create flutter sub directories for client and server within the contacts app? Is it a ready template or did you manually create those sub directories?
Thanks for this. Is there a way to "watch" for the changes? So that we don't need to press the refresh button and changes are automatically reflected on every client?
Hi Matt, not sure I caught your question correctly. We create a server that runs on "localhost" and we use a MongoDB client for retrieving data. Hitting the particular endpoints on our server calls the operation that talks to our database. Did you watch the full video?
I suppose you can use the getCollectionInfos or getCollectionNames methods and then filter for the one you want pub.dev/documentation/mongo_dart/latest/mongo_dart/Db-class.html
Hey Abdul, are you connecting to the right database? I hope you aren't using the connection string in the GitHub repo. What exceptions are you getting? Any 400-500 response in the Network panel or is the connection hanging?
@@CreativeBracket i created a new database and connected to it by changing the relevant database collection names ,error what i getting is in dio as "[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 57954"
i want to build web flutter and join it in server and run server one time like react js with express js app.use(express.static(path.join(__dirname,'/client/build')) )
Hi Man! Loved your tutorial. I just want to know if you have tried implementing real-time updates using MongoDB and flutter. I tried to look for some tutorials for this but I found. Can you please share your thoughts regarding this one. Thanks!
@@CreativeBracket server is running fine i have used reqbin and browser both are giving results but couldn't fetch the data because api not making connection with the server i tried with http but failed.
Yes, you won't be able to access localhost on your host machine from your physical device, unless you either use your host machine's ip address, use ngrok or deploy your server to Heroku or similar.
Just a matter of preference. Android Studio works too although I imagine it uses up a lot more system resources. Might switch up the editors in future tutorials however ;)
I keep getting this error when I try to connect to the server E/flutter ( 6914): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 37315 I keep getting a random port and I cant connect. Anyone have any idea how to solve this issue? Thanks!
Looks like the connection is being refused. Is the server running? Are you connecting to the correct endpoint? Is it a CORS issue? Any other errors/warnings in the console? Either see the solution source code or raise a Github issue.
your IP address is the issue, go to your MongoDB atlas and whitelist your IP, or if you are still in the development phase just make it accessible to any IP address
Hi, I have a problem. My Post is returning: "FormatException: Unexpected character (at character 2) {name: teste} ". When I send an empty request: {}, it works perfectly. I didn't find anything that could help me. The other verbs work (get and delete). Could anyone help me? Thanks.
@@CreativeBracket Thanks for the answer, but I was not so clear in my doubt. This is the command I perform: curl.exe -i -X POST -H "Content type: application / json" -d '{"name": "test"}' http: // localhost: 8081 And this is the error: Unhandled exception: FormatException: unexpected character (at character 2) {name: test} The same error occurs when the Postman process occurs as well. Could you still help me? Thank you.
@@lucasrios3050 From the curl command "Content type: application / json" should be "Content-Type: application/json". If this still persists raise a Github issue with the code you use for your serv.post() method
it didn't work for me => Because every version of sevr depends on body_parser ^1.1.1 which depends on http_parser ^3.1.1, every version of sevr requires http_parser ^3.1.1. And because http >=0.13.0 depends on http_parser ^4.0.0, sevr is incompatible with http >=0.13.0. Because basic_utils >=3.3.1 depends on http ^0.13.3 and basic_utils >=3.0.0-nullsafety.0 =3.0.0-nullsafety.0 requires http ^0.13.0. Thus, sevr is incompatible with basic_utils >=3.0.0-nullsafety.0. And because mongo_dart 0.7.4 depends on basic_utils ^3.0.0 and no versions of mongo_dart match >0.7.4
Check out this mini-course update using the latest Dart Shelf, Shelf_router and Shelf_web_socket packages! th-cam.com/video/ggfjXPX5G6o/w-d-xo.html
Are you an angel seriously?? Thanx for these tutorials!!
You're welcome Harsh!
I liked this tutorial and your video editing skills made this course not boring.
This is the one to watch out for !
Thanks man, I learned a lot !
You're welcome Arup :)
I had been looking for using mongo db and flutter together and even watched the 3 vids on mongo dart package and also this one am watching thanks Man U are priceless
Cheers friend. Glad it helped :)
thnx for this :) do more tutorials on flutter with mongoDB
This is the best course I've viewed on TH-cam. Great job.
I did have a problem running the code. Works fine in MS Edge, but on my mobile, or in Chrome i get this error:
Syncing files to device I3312...
Restarted application in 2,397ms.
D/libc-netbsd( 6087): getaddrinfo: get result from proxy gai_error = 0
E/flutter ( 6087): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: DioError [DioErrorType.other]: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 51944
E/flutter ( 6087): #0 DioMixin.assureDioError (package:dio/src/dio_mixin.dart:819:20)
Was there any other errors in the Chrome console like cors maybe?
Great work.. Saved lot of time following this tutorial. Thanks a lot.
You're welcome Mahboob!
Your channel got a lot of valuable content. Thanks bro 🙂. You gotta new subscriber! Keep rocking 🔥
Cheers Althafar, really appreciated
This is really good brother, please consider teaching how to Realm for offline first approach in a project; like a notes taking app ( user can create a note even when offline and later sync with the cloud,)
Subed
Thanks for the tip. Will see about Realm when the official package reaches stable github.com/realm/realm-dart
OMG, this tutorial is great. Since I am still a Flutter beginner it blew my mind a little bit :). Do you also have some Flutter tuts for beginners going? Cheers
Thanks Jan! For Flutter beginners I'll advise starting with Dart th-cam.com/video/F4o1tK0U5N4/w-d-xo.html
Amazing video man, thank you so much, leaving subscription for futher videos :)
Thanks for the sub! :)
thanks a lot man !! ♥
cool bro. way to go. thumbsy.
Thanks George 👍🏾
Thank you sir.
You're welcome Aib!
More videos bro .. pls next time show how to set flutter to make use of the device default font instead of flutter font. And if the device don't is changed by the user then the app fonts changes too. I'll be grateful. Thanks for this btw
i've learned a ton from the way you describe things, very clear in your teaching, do you have a flutter course yet? or is that part of the dart course you have on creativebracket?
I've got the Firebase Flutter 2020 Course th-cam.com/video/oyVDDRczuJI/w-d-xo.html I'd love to produce a premium course at some point
Thanks for the video - sadly when I look at the lack of popularity of packages like serv and still no real official module for mongodb... I am going SQL instead. Liked the video though!
Sure, whichever works for you. The mongo_dart package is still maintained and an official mongo dart realm package is in the works github.com/realm/realm-object-server/issues/55#issuecomment-722600281
I'd look at the shelf package by the Dart team for setting up servers, and has null-safety enabled
hi, how can i solve?
ERROR:
Unhandled exception:
MongoDB ConnectionException: connection closed: The socket connection has been reset by peer.
Possible causes:
- Trying to connect to an ssl/tls encrypted database without specifiyng
either the query parm tls=true or the secure=true parameter in db.open()
- Others
hello you can help me please i want to make a rest api which retrieves data from the sample_restaurants.restaurants collection with flutter
Can we perform all the actions without APIs? i mean if we connect mongo db directly from flutter app. Is it good way to reduce api building?
How did you create flutter sub directories for client and server within the contacts app? Is it a ready template or did you manually create those sub directories?
There are ready-made templates you can use. See dart.dev/tools/dart-create
Thanks for this. Is there a way to "watch" for the changes? So that we don't need to press the refresh button and changes are automatically reflected on every client?
You'll need a websocket server, something like Socket io pub.dev/packages/socket_io
Very helpful video,
I hv a question.
Why create a server when the mongo_dart package worked well
To separate the persistence layer from the client. It reflects more of a real-world use case
How to connect to mongodb atlas. I'm unable to connect.
Hi, in the api.dart you are using localhost, I'm confused on how can I do if I wanted to retrieve data from Mongodb?
Hi Matt, not sure I caught your question correctly. We create a server that runs on "localhost" and we use a MongoDB client for retrieving data. Hitting the particular endpoints on our server calls the operation that talks to our database. Did you watch the full video?
@@CreativeBracket Thanks for your answer sir. I got it now.
THANK U
You're welcome!
You're creating dope content. What is the best way to move server like this to internet?
You can use Heroku or AWS. See the following tutorials:
- th-cam.com/video/IRZ7WH98lLA/w-d-xo.html
- th-cam.com/video/KxeVsB68H58/w-d-xo.html
Hi. i am having a problem.
Error :
Index out of range: index should be less than 1: 1
how can i solve?
Hi Kaan, I didn't get this problem myself. How did you get to this exception?
How do you check if the contacts collection already exists from the dart code?
I suppose you can use the getCollectionInfos or getCollectionNames methods and then filter for the one you want pub.dev/documentation/mongo_dart/latest/mongo_dart/Db-class.html
hey Jermaine, when I run the master application which was in Github the app keeps on loading and other features are not working, what is the reason
the contacts are added in database but not showing in the app
just the loading mark in the app
Hey Abdul, are you connecting to the right database? I hope you aren't using the connection string in the GitHub repo. What exceptions are you getting? Any 400-500 response in the Network panel or is the connection hanging?
@@CreativeBracket i created a new database and connected to it by changing the relevant database collection names ,error what i getting is in dio as "[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 57954"
i want to build web flutter and join it in server and run server one time
like react js with express js
app.use(express.static(path.join(__dirname,'/client/build')) )
I only saw mongDB with nodejs, so its not necessary to use nodejs for server side?
Dart presents another option for serverside, so depending on your use case you may not need node.
Bro do lot of video related to it, thanks
What sort of videos are you thinking of?
Bro, may I ask how did you create that server module?
If you mean the sevr package, I didn't. Will be releasing an updated course with null-safety, Shelf_router and WebSockets soon
Hi Man! Loved your tutorial. I just want to know if you have tried implementing real-time updates using MongoDB and flutter. I tried to look for some tutorials for this but I found. Can you please share your thoughts regarding this one. Thanks!
Can look into once the official MongoDB Realm package reaches a stable milestone github.com/realm/realm-dart
how to get sevr?
Have you Checked This On Current Version sevr package are not updated till now it's not working for me
Will be releasing an updated course with null-safety, Shelf_router and WebSockets soon
hi, really helpful tutorial keep going. I have an error on package sevr. can you please tell the alternative package for sevr?
Sure, I've updated this mini-course using Shelf packages th-cam.com/video/ggfjXPX5G6o/w-d-xo.html
I can't connect flutter to any mongodb database... it always says it can't connect
Are you connecting directly or via the server?
I have tried to run your source code couldn't get throw it because it show socketerror 111 ,110, connection refused or like that.
Is the server running? Did you set the correct connection string for MongoDB Cloud Atlas?
@@CreativeBracket server is running fine i have used reqbin and browser both are giving results but couldn't fetch the data because api not making connection with the server i tried with http but failed.
Hmmm, I took another look and can't seem to reproduce your issue. Are you running this on your physical device?
@@CreativeBracket yes physical android device and even in chrome browser.
Yes, you won't be able to access localhost on your host machine from your physical device, unless you either use your host machine's ip address, use ngrok or deploy your server to Heroku or similar.
Thank you for the tutorial! Is there a reason you use VScode over Android Studio?
Just a matter of preference. Android Studio works too although I imagine it uses up a lot more system resources. Might switch up the editors in future tutorials however ;)
@@CreativeBracket Thank you and good to know!
33:10 How to use changeStreams and update all devices contact list without the refresh button ?
Will be releasing an updated course with WebSocket support in the next couple of days!
I keep getting this error when I try to connect to the server
E/flutter ( 6914): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 37315
I keep getting a random port and I cant connect. Anyone have any idea how to solve this issue?
Thanks!
Looks like the connection is being refused. Is the server running? Are you connecting to the correct endpoint? Is it a CORS issue? Any other errors/warnings in the console? Either see the solution source code or raise a Github issue.
I got the same issue.
your IP address is the issue, go to your MongoDB atlas and whitelist your IP,
or if you are still in the development phase just make it accessible to any IP address
Is there a way you can do user authentication using mongodb w/out using firebase??
Yes, see this tutorial on User Registration and Authentication with Dart th-cam.com/video/HloDTrNH37c/w-d-xo.html
Hi, I have a problem. My Post is returning: "FormatException: Unexpected character (at character 2)
{name: teste} ". When I send an empty request: {}, it works perfectly. I didn't find anything that could help me. The other verbs work (get and delete). Could anyone help me? Thanks.
Hey Lucas, you should wrap the key in quotes like so: {"name": 'teste'}
@@CreativeBracket Thanks for the answer, but I was not so clear in my doubt. This is the command I perform:
curl.exe -i -X POST -H "Content type: application / json" -d '{"name": "test"}'
http: // localhost: 8081
And this is the error:
Unhandled exception:
FormatException: unexpected character (at character 2)
{name: test}
The same error occurs when the Postman process occurs as well.
Could you still help me? Thank you.
@@lucasrios3050 From the curl command "Content type: application / json" should be "Content-Type: application/json". If this still persists raise a Github issue with the code you use for your serv.post() method
@@CreativeBracket Hello, thanks again for your attention. Follow github link: github.com/LucasRius/mongofluuter.git
@@CreativeBracket ?
Can you please host this api to heroku not static website but the one using MongoDB
I do have this tutorial showing how to deploy your Dart app to Heroku th-cam.com/video/IRZ7WH98lLA/w-d-xo.html
how to add refresh contacts automatically???
what i need to apply it???
You will need a websocket based connection. Check out libraries like this one pub.dev/packages/socket_io
can u explain where did you have the port number ?
This port number? github.com/graphicbeacon/flutter_mongodb_contacts_app/blob/main/server/lib/server.dart#L12
@@CreativeBracket can i change to another value ? like 9087 or else ?
@@danangdwigustifajaryanto Yes you can
it didn't work for me => Because every version of sevr depends on body_parser ^1.1.1 which depends on http_parser ^3.1.1, every version of sevr requires http_parser ^3.1.1.
And because http >=0.13.0 depends on http_parser ^4.0.0, sevr is incompatible with http >=0.13.0.
Because basic_utils >=3.3.1 depends on http ^0.13.3 and basic_utils >=3.0.0-nullsafety.0 =3.0.0-nullsafety.0 requires http ^0.13.0.
Thus, sevr is incompatible with basic_utils >=3.0.0-nullsafety.0.
And because mongo_dart 0.7.4 depends on basic_utils ^3.0.0 and no versions of mongo_dart match >0.7.4
Yeah, try replacing the sevr implementation with shelf
@@CreativeBracket thanks for your respond i will try your solution to manage it
karia (red herart )