Skip to content

Commit 32977fe

Browse files
committed
Added library values
1 parent 0b797e0 commit 32977fe

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

docs/resources/projects/libraries.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,82 @@ You can easily upgrade to newer versions of the libraries as they become availab
226226

227227
![update-library](imgs/update-library.avif)
228228

229+
## Library Values
230+
231+
**Library Values** are essentially variables created by a library publisher and intended to be set by the library consumer. These values allow library publishers to create configurable variables that are useful in different contexts, such as API keys, global settings, or other project-specific configurations. These values allow consumers to input specific data required for the library to function properly in their project.
232+
233+
For example, If someone has built a library that uses OpenAI API, they would define a Library Value for the OpenAI API key. As the consumer of the library, when you import, you must provide your own API key to ensure the library functions properly.
234+
235+
By using Library Values, the publisher allows consumers to adapt the library to their own configurations without hardcoding sensitive or project-specific data, like API keys, into the library itself.
236+
237+
### Create Library Values
238+
239+
The publisher defines the variable name, data type (e.g., string, enum), whether the variable is nullable, and an optional default value.
240+
241+
To create library values, navigate to **Settings and Integrations > App Settings > Publish as Library > Library Values** section and click **+ Add Value**.
242+
243+
<div style={{
244+
position: 'relative',
245+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
246+
height: 0,
247+
width: '100%'}}>
248+
<iframe
249+
src="https://demo.arcade.software/vGIveMr1UmSlaiOreYmR?embed&show_copy_link=true"
250+
title=""
251+
style={{
252+
position: 'absolute',
253+
top: 0,
254+
left: 0,
255+
width: '100%',
256+
height: '100%',
257+
colorScheme: 'light'
258+
}}
259+
frameborder="0"
260+
loading="lazy"
261+
webkitAllowFullScreen
262+
mozAllowFullScreen
263+
allowFullScreen
264+
allow="clipboard-write">
265+
</iframe>
266+
</div>
267+
<p></p>
268+
269+
### Set Library Values
270+
271+
To set library values, navigate to **Settings and Integrations > Project Setup > Project Dependencies** page. When you import a library, you'll be prompted to set values for required Library Values. If the library has already been added, click on **View Details**, which will open a dialog and then you can enter a value.
272+
273+
<div style={{
274+
position: 'relative',
275+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
276+
height: 0,
277+
width: '100%'}}>
278+
<iframe
279+
src="https://demo.arcade.software/JG68MN6oBpZpPvHnKDmh?embed&show_copy_link=true"
280+
title=""
281+
style={{
282+
position: 'absolute',
283+
top: 0,
284+
left: 0,
285+
width: '100%',
286+
height: '100%',
287+
colorScheme: 'light'
288+
}}
289+
frameborder="0"
290+
loading="lazy"
291+
webkitAllowFullScreen
292+
mozAllowFullScreen
293+
allowFullScreen
294+
allow="clipboard-write">
295+
</iframe>
296+
</div>
297+
<p></p>
298+
299+
After setting Library Values, they function just like any other variable in FlutterFlow. You can bind them to components, actions, or API calls, allowing you to easily configure dynamic settings across your project.
300+
301+
:::tip
302+
For different [**development environments**](../../testing-deployment-publishing/development-environments/development-environments.md) (e.g., development vs. production), you can bind Library Values to [**environment values**](../../testing-deployment-publishing/development-environments/development-environments.md#use-environment-values). For instance, you could have two different Library Values for an API key, such as `DEV_OPENAI_API_KEY` and `PROD_OPENAI_API_KEY`, and bind them to the development and production environments to track API usage separately.
303+
:::
304+
229305
## FAQs
230306

231307
<details>

0 commit comments

Comments
 (0)