Custom Functions
Inside this section, you'll learn to add custom functionalities to your app by visiting the following pages:
If you plan to use a dependency from pub.dev into a custom widget or action, you must go through the following steps:
You will find varieties of dependencies for a specific requirement, and choosing the best one can be challenging. This section helps you identify the right dependency by examining its score.
When you search for any dependency in pub.dev, you will get a list of dependencies. You can filter out the result based on which dependency is more inclined toward your needs. You can do so by opening and checking each dependency manually.
Once you have a handful of dependencies, you can consider the following factors while choosing the final one.
- 1.WEB: It must support Web to be able to see, modify and run it in our Run/Test Mode.
- 2.Likes: This shows how many developers have liked a dependency.
- 3.Pub Points: Tells the quality of the dependency (out of 130) based on code style, platform support, and maintainability
- 4.Popularity: This shows how many developers are using it (out of 100%).

Dependency score
To use the dependency code in our code editor, you must copy its name with version. To do so, click the "Copy to Clipboard" (
) icon.


Copying dependency/package
The current dependency might depend on other dependencies to work. So make sure to copy the name and version of all the additional dependencies as well to specify in the code editor.
You can check if the current dependency has any additional dependencies inside the Dependencies section at the bottom right side.

Additional dependencies
An import statement is usually a path where the code for the dependency resides. While creating the custom widget or action, you will need the package import statement to be written at the top, inside the code editor.
Open the dependency page and select the installing tab; under the Import it section, you'll find the import statement. To copy, click the "Copy to Clipboard" (
) icon.


Copying Import statement
At any point, if you feel like you are unable the understand and fix the issue, you can use ChatGPT (an advanced artificial intelligence system to perform a wide range of natural language processing tasks) from OpenAI to get help.
Simply open the ChatGPT and enter the prompt like:
Identify and fix the issue in this code: [paste-your-custom-widget-code]
Once you've entered your prompt, ChatGPT will provide you with a helpful response that can guide you toward a solution. If the response includes only an updated line of code with the fix, you can simply copy and paste it into your code editor. If you need more help or want to see the full updated code, you can ask ChatGPT to provide a full code with the fix. Here is the simple prompt:
Write down the full code with the fix
Now paste the updated code in the code editor, save the progress, and compile the widget!

Using ChatGPT to auto-identify and fix the issue.
Last modified 1mo ago