GithubHelp home page GithubHelp logo

@named() about get_it HOT 6 CLOSED

S26T avatar S26T commented on August 26, 2024 2
@named()

from get_it.

Comments (6)

anaisbetts avatar anaisbetts commented on August 26, 2024 4

I think it's a good idea, because otherwise you end up having to make bogus types for silly reasons:

// The type here is `string`, a very common type!
locator.registerSingleton("http://the/url", name: "ServiceURL");

vs:

// ugh ugh ugh
class ServiceUrlContainer { ... }
locator.registerSingleton(ServiceUrlContainer("http://the/url"));

from get_it.

escamoteur avatar escamoteur commented on August 26, 2024 4

Implemented in V1.1.0

from get_it.

escamoteur avatar escamoteur commented on August 26, 2024

Hmm, not sure if I like it here. @anaisbetts what do you think?

from get_it.

S26T avatar S26T commented on August 26, 2024

for example:

need to add some sharedpreferance objects, but different by key name.

SharedPreference sp1 = SharedPreference(Key1, mode);
SharedPreference sp2 =
SharedPreference(Key2, mode);

from get_it.

lukepighetti avatar lukepighetti commented on August 26, 2024

New to service locators but that seems like an anti-pattern for get_it to store strings instead of something like a resources service.

from get_it.

anaisbetts avatar anaisbetts commented on August 26, 2024

@lukepighetti Probably, there are more compelling examples though of objects that are difficult to differentiate solely on type. For example, if you have a DiskCache interface, you might want the InUserProfile and TemporaryCached instances, even though these are implemented by the same type

from get_it.

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.