Create Custom Packages for Flutter Apps

Craig Oda
theta360.guide
Published in
2 min readMay 17, 2021

I’ve started to create a custom package to manage the API calls to the RICOH THETA camera. The first step is covered in this video.

Instead of maintaining a separate API library, I’ve decided to put the package in the same folder as my main project.

By including the package in my project, I don’t have to maintain the versions of the library separately from my project. My previous attempt at building an theta API library slowed down as the library got more complex. The last attempt did result in a large number of tests.

To make the application more usable, both the screens and files for the app need better organization.

The current structure works fine if there are 20 API commands, but breaks down when there are 50. As they options can be connected together, I need to handle several hundred possible settings.

In addition, I need to pull single values from state or info such as battery level, camera model or firmware version.

In my third attempt at making a library, I’ve started to structure the files around the structure of the RICOH THETA API documentation.

The video tutorials are being built up in this playlist.

The tutorial on creating custom Dart packages does not require a camera. I use a free API testing server called JSON Placeholder to test an http API connection.

The goal of the tutorial is to connect Flutter buttons to the library. At the moment, the response window does not show the result of the API request.

In the next video, I will show how to use Provider to put the results of the API response into the bottom scrollable response window.

Check out the first video our tutorial series now.

--

--

Craig Oda
theta360.guide

open source advocate, writer, Flutter developer, father, husband, fly fisherman, surfer