---
lang: en
title: 'API docs: context.provider'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.provider.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [Provider](./context.provider.md)

## Provider interface

Providers allow developers to compute injected values dynamically, with any dependencies required by the value getter injected automatically from the Context.

**Signature:**

```typescript
export interface Provider<T> 
```

## Example


```ts
export class DateProvider implements Provider<Date> {
  constructor(@inject('stringDate') private param: String){}
  value(): Date {
    return new Date(param);
  }
}

ctx.bind('stringDate').to('2017-01-01')
ctx.bind('provider_key').toProvider(DateProvider);

const value = ctx.getAsync('provider_key');
// value is a Date instance
```

## Methods

<table><thead><tr><th>

Method


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[value()](./context.provider.value.md)


</td><td>


</td></tr>
</tbody></table>


