# How is Scope different from 'x'

We receive a lot of questions about how Scope is different from other packages in the Dart ecosystem. So here are a few comparisons.

If one of these is your package and I've mis-represented it, apologies in advance and drop me a line with any corrections.

## Get It

GetIt is quite different in that it is essentially a singleton.

There is only one instance of getit for you whole application that you can add services into.

When using Scope you will end up with lots of instances of Scope and each one may have different values injected.&#x20;

As Dart is asynchronous you may have multiple Scopes active at one time (even before you start nesting scopes).

A classic example is a call to a database (db) connection.

From a FutureBuilder you might do a db call.

So you get a db from your pool and push it into a scope.

Now any code called within that scope has access to that db connection.

**Now this is where Scope is different to getIt**

If you have another FutureBuilder running at the same time it may also need to access the db.

So you create another scope with its own db connection.

The two future builders now run happily, each with their on db connection and they won't interfere with each other.

Usage of Scope is complementary to GetIt and many apps will use both.

## Provider

Provider and similar packages (river pod) also provide dependency injection but they do it for you widget build method.

In Flutter widget build methods are not on your call stack. Instead the build method is called from the Flutter framework.

This is one reason why Flutter has been so problematic as its hard to pass data around. You can't just pass things down your call stack.

Scope on the other hand does dependency injection for you call stack. It works for any methods/functions/constructors that are called on your call stack.

Usage of Scope is complementary to GetIt and many apps will use both.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://scope.onepub.dev/guides/how-is-scope-different-from-x.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
