Skip to content

Commit 357a3f5

Browse files
committed
Revert back to fixed version because of changes lost during previous merge :/
1 parent f31c415 commit 357a3f5

File tree

1 file changed

+91
-62
lines changed

1 file changed

+91
-62
lines changed

docs/resources/projects/libraries.md

Lines changed: 91 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,41 @@ slug: libraries
33
title: Libraries
44
tags: [Libraries]
55
keywords: [Libraries, Share, Reuse, Collaborate, Modularize, Dependency]
6-
description: Learn how to share and reuse entire FlutterFlow projects using libraries.
7-
sidebar_position: 6
6+
description: Learn how to share and reuse entire FlutterFlow projects suing libraries.
7+
sidebar_position: 4
88
---
99
import Tabs from '@theme/Tabs';
1010
import TabItem from '@theme/TabItem';
1111

1212
# Libraries
1313

14-
In FlutterFlow, a project can either be used to create an App or used to create a Library. A library allows you to share and reuse resources created in FlutterFlow across multiple projects. More specifically, with libraries, you can publish components, API calls, custom code, and more - all with version control. By using libraries, development becomes more efficient and scalable.
14+
Libraries enables you to share and reuse entire FlutterFlow projects as dependencies across multiple projects. This allows teams and developers to modularize their apps by creating shared libraries that include components, API calls, custom code, and more. By using libraries, development becomes more efficient and scalable.
1515

16-
Imagine you're building an e-commerce app, and different teams are working on various features. One team develops a complex payment system. By using libraries, they can publish the payment system as a reusable library and allow other teams to easily import and integrate it into multiple projects without duplicating development efforts.
17-
18-
![libraries.avif](imgs/libraries.avif)
19-
20-
:::tip[possible usecases]
16+
:::info
17+
A **Dependency** refers to an external library or resource that your project relies on to function correctly. When you create a new FlutterFlow project, certain dependencies are automatically added to support the generated code. Also, when you use a [Custom Widget](../../ff-concepts/adding-customization/custom-widgets.md), you are essentially adding dependencies to your project. Libraries take this concept further by allowing you to add entire FlutterFlow projects as dependencies.
18+
:::
2119

22-
- **Modular Development**: Build large-scale apps by separating them into smaller, independently managed projects (e.g., UI library, backend integrations, etc.).
23-
- **Team Collaboration**: Share reusable UI components, custom functions, or API integrations across multiple apps
24-
- **Community Sharing**: Publish libraries that can be imported and reused by the broader FlutterFlow community - like UI Kits or utility functions.
20+
Imagine you're building an e-commerce app, and different teams are working on various features. One team develops a complex payment system. By using the Libraries, they can publish the payment system as a reusable library and allow other teams to easily import and integrate it into multiple projects without duplicating development efforts.
2521

26-
:::
22+
![libraries.avif](../imgs/libraries.avif)
2723

28-
### What’s Included When Importing a Library
24+
### Importance of Libraries
2925

30-
When you import a library into a FlutterFlow project, the following resources are accessible for use:
26+
Previously, FlutterFlow offered several methods to share resources between projects, such as team code libraries, design systems, API libraries, and by leveraging marketplace items. However, these methods had limitations, including the inability to share custom data types or custom functions alongside components or API calls and the absence of version control.
3127

32-
- [Components](../resources/ui/components/intro-components.md)
33-
- [Data Types & Enums](../resources/data-representation/custom-data-types.md)
34-
- [App State Variables](../resources/data-representation/app-state.md)
35-
- [Constants](../resources/data-representation/constants.md)
36-
- [API Endpoints](../resources/control-flow/backend-logic/api/rest-api.md)
37-
- [Action Blocks](../resources/control-flow/functions/action-blocks.md)
38-
- [Custom Functions](../ff-concepts/adding-customization/custom-functions.md), [Actions](../resources/control-flow/functions/action-flow-editor.md), and [Widgets](../resources/ui/widgets/intro-widgets.md)
39-
- [Assets](../resources/projects/settings/general-settings.md#app-assets) (Note: These are not versioned)
28+
With Libraries, you can publish the complete FlutterFlow project as a library and import it as a dependency into other projects.
4029

41-
:::note
30+
:::tip[possible usecases]
4231

43-
Pages and Firestore Collections are still being worked on and may come in future updates.
32+
- **Modular Development**: Build large-scale apps by separating them into smaller, independently managed projects (e.g., UI library, backend integrations, etc.).
33+
- **Team Collaboration**: Share reusable UI components, custom functions, or API integrations across multiple apps within a team.
34+
- **Community Sharing**: Publish libraries that can be imported and reused by the broader FlutterFlow community.
4435

4536
:::
4637

4738
## Publishing a Library
4839

49-
To publish a project as a library, start by creating a FlutterFlow project as you normally would. Next, go to the **Publish as a Library** page in **App Settings**. Here you can specify the version number and message for the version you are publishing.
40+
To publish a FlutterFlow project as a library, start by creating a FlutterFlow project as you normally would, then follow these steps:
5041

5142
<div style={{
5243
position: 'relative',
@@ -55,7 +46,7 @@ To publish a project as a library, start by creating a FlutterFlow project as yo
5546
width: '100%'}}>
5647
<iframe
5748
src="https://demo.arcade.software/CTuBPgISjpRWy5TT6rRD?embed&show_copy_link=true"
58-
title="Publishing a Library"
49+
title=""
5950
style={{
6051
position: 'absolute',
6152
top: 0,
@@ -77,13 +68,11 @@ To publish a project as a library, start by creating a FlutterFlow project as yo
7768
:::info
7869
- You can only publish libraries if you have access to branching, which is available to Pro+ users.
7970
- Libraries can only be published from the main branch, and each published version is linked to a specific commit, ensuring robust version control.
80-
- You must commit your changes before publishing a new version of the library.
81-
- It's recommended to include a message that tells users what has changed in the version your are publishing.
8271
:::
8372

8473
## Importing a Library
8574

86-
To import a library project into another FlutterFlow project, you must go to the **Project Dependencies** page in **App Settings**. Here you can specify the library project and version you are importing.
75+
Open the FlutterFlow project where you'd like to import a library, then follow these steps:
8776

8877
<div style={{
8978
position: 'relative',
@@ -92,7 +81,7 @@ To import a library project into another FlutterFlow project, you must go to the
9281
width: '100%'}}>
9382
<iframe
9483
src="https://demo.arcade.software/DrzjKuhTWZXOxBB5yGJn?embed&show_copy_link=true"
95-
title="Importing a Library"
84+
title=""
9685
style={{
9786
position: 'absolute',
9887
top: 0,
@@ -112,80 +101,120 @@ To import a library project into another FlutterFlow project, you must go to the
112101
<p></p>
113102

114103
:::info
104+
You can only select a library if you have been added as a collaborator in that library project. To use a library, you must have one of these roles in the library project: Owner, Manager, Editor, or Read-Only.
105+
:::
115106

116-
- You can only select a library if you have at least read access on the library project.
117-
- For a library project to show in the drop down, you must be added as a collaborator on the project and the library project must have a published version.
118-
- You can import publicly accessible libraries by specifying the project ID in the text field when adding a library dependency.
119-
- By default, the latest published version of the library is imported, but you can choose to depend on an earlier version if needed.
120-
- You can also import the `current` version of the library to use the latest state of the library on the main branch - however, this is not recommended.
121-
- You must have a paid plan to import a library.
122107

123-
:::
108+
### Dependency Conflicts
109+
110+
A **Dependency Conflict** occurs when two or more libraries added by a project depend on different versions of the same dependency. This creates a situation where the project cannot resolve which version to use, leading to a project error.
124111

112+
![dependency-conflict.avif](../imgs/dependency-conflict.avif)
113+
114+
Let's say you are building an eCommerce app that uses multiple libraries for different purposes:
115+
116+
- **User Auth Library** is used for handling user authentication.
117+
- **Payment Gateway Library** is used for managing the payment gateway.
118+
119+
Both library projects depend on a common library called **Components Library** but imports different versions respectively:
120+
121+
- **User Auth Library** depends on `Components Library v1.5.0`.
122+
- **Payment Gateway Library** depends on `Components Library v2.0.0`.
123+
124+
In this scenario, the eCommerce project will detect the dependency conflict because it can't add both `v1.5.0` and `v2.0.0` of the Components Library at the same time.
125+
126+
#### Fixing Dependency Conflicts
125127

126-
You can easily upgrade to newer versions of the libraries as they become available. If a new update causes issues with your existing implementation, you also have the option to revert to a previous version.
128+
Follow these steps to ensure both libraries rely on the same version of Components Library:
127129

128-
![update-library.avif](imgs/update-library.avif)
130+
1. **Upgrade both libraries**: If updates are available, start by upgrading both the User Auth Library and Payment Gateway Library to their latest versions. Often, newer versions of libraries are designed to use the latest version of the Components Library, which can help resolve conflicts.
131+
2. **Modify Libraries**: If you have access to the library projects, adjust the dependencies of either User Auth Library or Payment Gateway Library (or both) to use the same version of the Components Library.
132+
3. **Contact Library Maintainers**: If you do not own the library yourself, reach out to the maintainers of the library projects. They may provide guidance, suggest workarounds, or release a version that addresses the conflict.
129133

130134
## Access Library Resources
131135

132-
Once the library is imported, components and resources are accessible within the project. It's important to note that these resources show up where they are instantiated. For example:
136+
Once the library is imported, following resources are accessible for use:
137+
138+
- [Components](../../resources/ui/components/intro-components.md)
139+
- [Data Types & Enums](../../resources/data-representation/custom-data-types.md)
140+
- [App State Variables](../../resources/data-representation/app-state.md)
141+
- [Constants](../../resources/data-representation/constants.md)
142+
- [API Calls](../../resources/control-flow/backend-logic/api/rest-api.md)
143+
- [Action Blocks](../../resources/control-flow/functions/action-blocks.md)
144+
- [Custom Functions](../../ff-concepts/adding-customization/custom-functions.md), [Actions](../../resources/control-flow/functions/action-flow-editor.md), and [Widgets](../../resources/ui/widgets/intro-widgets.md)
145+
- [Assets](../../resources/projects/settings/general-settings.md#app-assets) (Note: These are not versioned)
146+
147+
:::note
148+
Pages are still being worked on and may come in future updates.
149+
:::
150+
151+
It's important to note that these resources show up where they are instantiated. For example:
133152

134153
- **Components** appear in the widget palette.
135154
- **API calls** appear when making API calls in the action flow editor.
136-
- **App State variables** appear where you can update app state in an action or leverage app state in a widget property.
137155
- **Custom functions** are available when setting up actions or functions within the app.
138156

139157
This ensures that only relevant resources are shown where they are needed, optimizing performance and discoverability.
140158

141-
![access-library-resources.avif](imgs/access-library-resources.avif)
159+
![access-library-resources.avif](../imgs/access-library-resources.avif)
142160

161+
## Library Versioning
162+
Library versioning allows you to manage different versions of a library project over time. Using versioning, library users can control which version of a library to use in a project, ensuring compatibility and reducing the risk of breaking changes.
143163

144-
### Manage Dependency Conflict while Import
164+
:::info[Importance of Library Versioning]
165+
- **Maintain Backward Compatibility**: It ensures older versions of the library continue to work as expected while introducing new features.
166+
- **Roll Back Changes**: In case of bugs or issues in a new version, you can easily revert to a previous stable version.
167+
- **Control Updates**: Library users can decide when to upgrade to the latest version, rather than being forced into changes.
168+
:::
145169

146-
A **Dependency Conflict** occurs when two or more libraries added by a project depend on different versions of the same dependency. This creates a situation where the project cannot resolve which version to use, leading to a project error.
170+
### Publish New Version
147171

148-
![dependency-conflict.avif](imgs/dependency-conflict.avif)
172+
When you're ready to update your library, ensure that all modifications are committed to the main branch of the library project and then publish as per instructions [here](#publishing-a-library).
149173

150-
Let's say you are building an eCommerce app that uses multiple libraries for different purposes:
174+
:::tip
151175

152-
- **User Auth Library** is used for handling user authentication.
153-
- **Payment Gateway Library** is used for managing the payment gateway.
176+
- While publishing a new version, add a description to highlight what's new or changed in this version.
177+
- Each time a new version is published, the version number will automatically increment.
154178

155-
Both library projects depend on a common library called **Components Library** but imports different versions respectively:
179+
:::
156180

157-
- **User Auth Library** depends on `Components Library v1.5.0`.
158-
- **Payment Gateway Library** depends on `Components Library v2.0.0`.
181+
### Import Specific Version
159182

160-
In this scenario, the eCommerce project will detect the dependency conflict because it can't add both `v1.5.0` and `v2.0.0` of the Components Library at the same time.
183+
When importing a library into a project, you have the flexibility to choose which version of the library to use. By default, the latest version will be selected.
161184

162-
#### Fixing Dependency Conflicts
185+
![import-specific-library-version.avif](../imgs/import-specific-library-version.avif)
163186

164-
Follow these steps to ensure both libraries rely on the same version of Components Library:
187+
### Update to Latest Version
165188

166-
1. **Upgrade both libraries**: If updates are available, start by upgrading both the User Auth Library and Payment Gateway Library to their latest versions. Often, newer versions of libraries are designed to use the latest version of the Components Library, which can help resolve conflicts.
167-
2. **Modify Libraries**: If you have access to the library projects, adjust the dependencies of either User Auth Library or Payment Gateway Library (or both) to use the same version of the Components Library.
168-
3. **Contact Library Maintainers**: If you do not own the library yourself, reach out to the maintainers of the library projects. They may provide guidance, suggest workarounds, or release a version that addresses the conflict.
189+
You can easily upgrade to newer versions of the libraries as they become available.
190+
191+
:::tip
192+
193+
- If a new update causes issues with your existing implementation, you also have the option to revert to a previous version.
194+
- Always test your app after upgrading to ensure that the new library version works well with your existing project.
195+
196+
:::
169197

198+
![update-library](../imgs/update-library.avif)
170199

171200
## FAQs
172201

173202
<details>
174203
<summary>What will happen to existing team libraries?</summary>
175204
<p>
176-
Team code and API libraries will be migrated to library Projects. These projects will be imported as a library with the latest version specified as the version. The components within team design systems will move into their own projects, while design systems will continue to exist but only containing the theme settings.
205+
Team code and API libraries will be migrated to Library Projects. These projects will be imported as a library with the latest version specified as the version. The components within team design systems will move into their own projects, while design systems will continue to exist but only containing the theme settings.
177206
</p>
178207
</details>
179208

180209
<details>
181-
<summary>Will libraries work with Marketplace?</summary>
210+
<summary>Will Libraries work with Marketplace?</summary>
182211
<p>
183212
We plan to allow users to import a marketplace project as a library, making it easier to integrate marketplace resources into your projects.
184213
</p>
185214
</details>
186215

187216
<details>
188-
<summary>How do libraries work with themes?</summary>
217+
<summary>How do Libraries work with themes?</summary>
189218
<p>
190219
The parent project's design system takes precedence over the imported library's design system. For example, if a library uses the standard FlutterFlow color scheme, the values defined in the parent project will override those in the library. However, if the library project has a custom color that the parent project does not have, it will be used as-is in the parent project.
191220
</p>
@@ -194,13 +223,13 @@ The parent project's design system takes precedence over the imported library's
194223
<details>
195224
<summary>How are API keys shared?</summary>
196225
<p>
197-
We're working on Library Values, which will allow users to set specific values when they import a library. This feature will be available soon.
226+
We're planning to leverage environment variables, as part of the Development Environment features, to allow users to add their API keys to their own projects. This ensures that the API key is not shared when the project is published as a library.
198227
</p>
199228
</details>
200229

201230
<details>
202231
<summary>How does nested dependencies work?</summary>
203232
<p>
204-
Projects can import libraries that themselves have imported other Libraries as dependencies. However, if the project and the library share the same dependency, the version must match exactly to avoid conflicts.
233+
Projects can import Libraries that themselves have imported other Libraries as dependencies. However, if the project and the Library share the same dependency, the version must match exactly to avoid conflicts.
205234
</p>
206235
</details>

0 commit comments

Comments
 (0)