Coder Social home page Coder Social logo

Comments (6)

dshukertjr avatar dshukertjr commented on June 17, 2024 1

Hi @phamhieu !

Yeah, sure! It might be a teeny-tiny difference, but with the current code using {}, this is how you would write SubscriptionCallback.

supabase
    .from('chats')
    .on(SupabaseEventTypes.all, (payload) {
  // Do something here
}).subscribe((event, {errorMsg}) {
  // Do something here
});

This has two limitations:

  • You have to wrap errorMsg with {}
  • You cannot change the variable name from errorMsg to something else

If we change the {} to [], we can get rid of both of the two restrictions and write it like this:

supabase
    .from('chats')
    .on(SupabaseEventTypes.all, (payload) {
  // Do something here
}).subscribe((event, errorMessage) {
  // `errorMsg` can be different variable name
  // Do something here
});

I know this is a very niche thing that I am pointing out, and is probably not the thing that should concern you, but is just my thoughts.

Thanks for all the amazing work! I love the Supabase dart client!

I am in the process of creating a sample app using flutter and Supabase, and was wondering if it would be okay for me to drop off feedback like this if I come across any?, or is there a better place for feedback like this other than Github issues?

from supabase-dart.

dshukertjr avatar dshukertjr commented on June 17, 2024

Wow, great title huh? lol

from supabase-dart.

phamhieu avatar phamhieu commented on June 17, 2024

Hi @dshukertjr, can you give more explanation for this quote

but I find the format of SubscriptionCallback a bit hard to work with. It might be easier if the errorMsg was an optional positional argument instead.

To me, the code is the same. Just a difference between {} and []

from supabase-dart.

phamhieu avatar phamhieu commented on June 17, 2024
  1. You have to wrap errorMsg with {}

but with the other way, you still have to wrap it with []. Correct me if i'm wrong. You can submit a PR as reference.

  1. You cannot change the variable name from errorMsg to something else

This' true.

from supabase-dart.

phamhieu avatar phamhieu commented on June 17, 2024

and was wondering if it would be okay for me to drop off feedback like this if I come across any?

Yes, please do so. Thank you so much.

from supabase-dart.

dshukertjr avatar dshukertjr commented on June 17, 2024

but with the other way, you still have to wrap it with []. Correct me if i'm wrong. You can submit a PR as reference.
You are absolutely right and I was absolutely wrong. Thank you for correcting me.

from supabase-dart.

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.