Skip to content

Commit 81d6e91

Browse files
committed
Add mention of utility library
1 parent 77cf2cb commit 81d6e91

File tree

2 files changed

+31
-36
lines changed

2 files changed

+31
-36
lines changed

docs/ff-concepts/adding-customization/custom-functions.md

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,33 @@ keywords: [FlutterFlow, Custom Functions, Customizations, Flutter, Dart, Pub.dev
88
---
99

1010
# Custom Functions
11-
Custom Functions in FlutterFlow allow you to perform simple Dart calculations and logic. These functions are ideal for tasks that require immediate results, such as data transformations, mathematical calculations, or simple logic operations. **Custom Functions** enable you to encapsulate reusable logic, making your code more organized and maintainable.
11+
Custom Functions in FlutterFlow allow you to perform simple Dart calculations and logic. These functions are ideal for tasks that require immediate results, such as data transformations, mathematical calculations, or simple logic operations. **Custom Functions** enable you to encapsulate reusable logic, making your code more organized and maintainable. Let's see some common examples:
12+
13+
**To calculate discount given price and discount rate:**
14+
15+
```js
16+
17+
double calculateDiscount(double price, double discountRate) {
18+
return price - (price * discountRate / 100);
19+
}
20+
```
21+
22+
**To capitalize a String input:**
23+
24+
```js
25+
String capitalize(String input) {
26+
return input.isNotEmpty ? '${input[0].toUpperCase()}${input.substring(1)}' : '';
27+
}
28+
```
29+
30+
**To convert Celsius to Fahrenheit**
31+
32+
```js
33+
double celsiusToFahrenheit(double celsius) {
34+
return (celsius * 9/5) + 32;
35+
}
36+
37+
```
1238

1339
## Key Use Cases
1440

@@ -77,38 +103,5 @@ function code. Instead, you can pass the app state variable as a parameter and t
77103
</details>
78104

79105

80-
## Some common examples
81-
82-
<details>
83-
<summary>Calculating Discounts:</summary>
84-
85-
```
86-
double calculateDiscount(double price, double discountRate) {
87-
return price - (price * discountRate / 100);
88-
}
89-
```
90-
91-
</details>
92-
93-
94-
<details>
95-
<summary>String Capitalization:</summary>
96-
97-
```
98-
String capitalize(String input) {
99-
return input.isNotEmpty ? '${input[0].toUpperCase()}${input.substring(1)}' : '';
100-
}
101-
```
102-
</details>
103-
104-
<details>
105-
<summary>Temperature Conversion:</summary>
106-
107-
```
108-
double celsiusToFahrenheit(double celsius) {
109-
return (celsius * 9/5) + 32;
110-
}
111-
112-
```
113-
</details>
114-
106+
## Utility Functions Library
107+
Instead of building everything from scratch, explore our **[Utility Functions Library](https://marketplace.flutterflow.io/item/ZVBmWMGpXe6vqnASRHDA)** — packed with 50+ helpful functions for everyday tasks like formatting text, manipulating dates, validating input, and more. Easily plug them into your custom logic to save time and reduce errors.

docs/ff-concepts/adding-customization/custom-widgets.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ FlutterFlow:
9999
</iframe>
100100
</div>
101101

102+
<p></p>
103+
102104
:::tip[Choosing a Pubspec Dependency]
103105
For a comprehensive guide on navigating external packages using pub.dev, evaluating packages, and making the best choices for your app, [**follow the guide**](custom-code.md#adding-a-pubspec-dependency).
104106
:::

0 commit comments

Comments
 (0)