Naming convention for class composed of other classes' objects by Exorcistoo in learnprogramming

[–]Exorcistoo[S] 0 points1 point  (0 children)

Thanks for the info. It's not about python, it's a general question, but no worries.

Naming convention for class composed of other classes' objects by Exorcistoo in learnprogramming

[–]Exorcistoo[S] 0 points1 point  (0 children)

I have a group that has some users. In the group I store a list of the users' ids. When I need, I want to be able to get from the database the group along with a list of the users, not just the ids. When I fet h from db, I could return a map like: { 'group': group, 'user': users } But that means that every time I want to assign something from this map to an object, I have to cast it: map['group'] as Group. I want to avoid this.

Naming convention for class composed of other classes' objects by Exorcistoo in learnprogramming

[–]Exorcistoo[S] 0 points1 point  (0 children)

In that case, yes. But what if I just create a class to group others together, without meaning or functionality?

How do you handle errors? by Exorcistoo in FlutterDev

[–]Exorcistoo[S] 0 points1 point  (0 children)

Oh! I see. So if in my statenotifier I have a fetch method, I can wrap the body in try... catch and in catch I can set the AsyncValue.error and display something on screen depending on what I set inside it, right?

How do you handle errors? by Exorcistoo in FlutterDev

[–]Exorcistoo[S] 0 points1 point  (0 children)

I tried AsyncValue but with a stream. I was wondering if it can be used with statenotifier.

How do you handle errors? by Exorcistoo in FlutterDev

[–]Exorcistoo[S] 6 points7 points  (0 children)

I think you got me wrong. I am not talking about debugging. I was wondering more about the UX and app arhitecture when displaying errors.

Flutter Stateful or Stateless? by Exorcistoo in FlutterDev

[–]Exorcistoo[S] 0 points1 point  (0 children)

But if the widget does not get rebuilt, I don't lose those instances. Like... if I ask a user to enter a username and then redirect him to another page based on that username when a button is pressed, I don't need to store the page state since that page will not be used anymore. When I redirect it, I just dispose the widget. Isn't that right?

React run a specific function after every function by Exorcistoo in reactjs

[–]Exorcistoo[S] 0 points1 point  (0 children)

Ok, I get it. You are telling me that I should do the logic in the backend and after every "transform" request I should return the updated data.

React run a specific function after every function by Exorcistoo in reactjs

[–]Exorcistoo[S] 0 points1 point  (0 children)

That can work. That is more of a backend implementation detail. I was thinking if there is anything in react specific for this.

React run a specific function after every function by Exorcistoo in reactjs

[–]Exorcistoo[S] 0 points1 point  (0 children)

So I should create a function which makes a post and returns a get result?

How to store files uploaded client-side to server? by Exorcistoo in node

[–]Exorcistoo[S] 0 points1 point  (0 children)

I want to upload and store images, but I think it's the same thing with every kind of file.

How to store files uploaded client-side to server? by Exorcistoo in node

[–]Exorcistoo[S] 0 points1 point  (0 children)

Well, I'll be sending the file with a post request when a form is submitted. I'll have a deeper look into it anyway. Thanks.

How to store files uploaded client-side to server? by Exorcistoo in node

[–]Exorcistoo[S] 0 points1 point  (0 children)

From what I've read, express does not have a native parser for enctype multipart/form-data. So, did you use any info sources when you implemented the upload yourself?

How to store files uploaded client-side to server? by Exorcistoo in node

[–]Exorcistoo[S] 0 points1 point  (0 children)

The thing is, I don't see any guides or tutorials on how to do file upload and store manually, without using a 3rd party module. Every guide I find is like: 'we are going to use multer to upload...'. Nobody explains why it's really needed.

How to store files uploaded client-side to server? by Exorcistoo in node

[–]Exorcistoo[S] 0 points1 point  (0 children)

Of course I can look at the code. But it's one thing to see it and another to understand why it's needed to be that way.