Flutter application that communicates with ESP32 devices through toit.io.

Last update: Dec 4, 2021

Demo of controlling IoT devices with Flutter

A project showcasing how a Flutter app can talk to an embedded device using Toit.

Available Demos

This project is intended to be used as starting point for Flutter applications that want to communicate with embedded devices or the Toit server. Just pick the functionality that is most similar to what you need, and remove the remaining pages.

Implementation Note

The Flutter app needs access to the Internet. The android/app/src/main/AndroidManifest.xml thus must include:

">

  

We have used Riverpod as state-management framework. It would be straight-forward to switch to a different framework, like Bloc.

Run the Demo

flutter run

For running the tests:

flutter test

Managing Devices

Listing of all devices

The "List Devices" page demonstrates how the Flutter app can connect to the Toit server to query all available devices.

It serves as a starting point for applications that want to manage the Toit fleet, or simply want to show the status of existing devices.

Device Logs

Device Log

The "Log" example connects to the Toit server to receive the logs of a selected device. It is one of the simplest API calls and serves as a good starting example.

However, the logs often contain valuable information, so this example is frequently useful in real apps.

Run

Run

This page shows how to run code on the device. This functionality is used in multiple demos, which is why a separate run-widget has been created.

The used 'run' command has many limitations. It doesn't support multiple files, and the program can only run for a limited time. Different API endpoints are responsible for managing the installed applications.

Pubsub Send

Pubsub Send

A simple pubsub example that sends a notification to the device.

This functionality can be used to send commands to devices. The Toit server will make sure that all notifications are eventually sent to the corresponding device (only giving up after 7 days).

Since this demo requires a receiving application on the device side, it also has functionality to temporarily run a Toit program on the device (similar to the "Run" demo). This functionality is independent and would normally be removed from the Flutter application.

Pubsub Listen In

Pubsub Listen In

This page demonstrates how a Flutter application can listen to events that are sent to a specific topic.

The application creates a fresh subscription, which means that it will only receive data that is sent once the subscription was created. Having its own subscription also means that it won't interfere with other listeners to the same topic.

This demo is primarily useful for devices that regularly send sensor data (like temperature, or distance) to the Toit servers, but where the Flutter application doesn't need stale data.

Pubsub Listen Heartbeat

Pubsub Listen Heartbeat

This example illustrates how a Flutter app can request a device to start producing data, so it can listen to it.

If producing data is expensive (in terms of power, bandwidth, ...), then devices should only generate data if there is a listener for it. The listeners thus initiate the generation of data by sending a request. The listeners are furthermore supposed to send a 'stop' signal, when they don't need data anymore. However, listeners may misbehave (for example by losing power). To protect against missing 'stop' events, the device requires listeners to send heartbeat notifications at fixed intervals to ensure that they are still alive and are still interested in the data.

Note: in this example, the request to receive data, and the heartbeat notification have been merged.

Pubsub RPC

Pubsub RPC

In this demo, the pubsub API is used to establish an RPC (remote procedure call) channel, so that the Flutter app can invoke methods on the device.

It uses the 'publish' functionality to send requests to the device, and receives the response in a stream.

The demo only supports methods that are initiated by the Flutter app, but it would be trivial to extend it so that the device can invoke end-points on the Flutter side as well.

GitHub

https://github.com/toitware/demo-flutter
You might also like...

A simple chat application in flutter made with stream.

A simple chat application in flutter made with stream.

chat_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Jul 29, 2022

๐Ÿš€ This is mobile application using Flutter for develop a pizza store

  ๐Ÿš€ This is mobile application using Flutter for develop a pizza store

Flutter Pizza Hut ๐Ÿ• Description: ๐Ÿš€ This is mobile application using Flutter for develop a pizza store ๐Ÿš€ Factory Method Create Enum product_type.dar

Feb 28, 2022

This project is a starting point for a Flutter application.

flutter_notebook_12th_story A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to

Feb 5, 2022

๐Ÿš€ This is mobile application using Flutter for develop Tiktok

     ๐Ÿš€ This is mobile application using Flutter for develop Tiktok

Flutter Tiktok Clone Description: ๐Ÿš€ This is mobile application using Flutter for develop Tiktok How I can run it? ๐Ÿš€ Clone this repo ๐Ÿš€ Run below cod

Feb 8, 2022

This is mobile application fortune telling using Flutter for development.

This is mobile application fortune telling using Flutter for development.

Flutter Tarot Card Description: This is mobile application fortune telling using Flutter for development. How I can run it? ๐Ÿš€ Clone this repository ?

Feb 28, 2022

This is project using flutter and firebase for develop a mobile application about online school

This is project using flutter and firebase for develop a mobile application about online school

This is project using flutter and firebase for develop a mobile application about online school

May 17, 2021

It is the Tangram application that I created using flutter.

It is the Tangram application that I created using flutter.

Tangram App What is a TANGRAM? Tangram is a creative intelligence game on the basis of creating various forms by combining seven geometrically shaped

Oct 2, 2021

An application built using Flutter that is to conduct a quiz and provide the user with the result of the quiz.

An application built using Flutter that is to conduct a quiz and provide the user with the result of the quiz.

Quizzler Challenge Solution This is a companion project to The App Brewery's Complete Flutter Development Bootcamp, check out the full course at www.a

Feb 3, 2022

Flutter ThingsBoard PE Mobile Application

Flutter ThingsBoard PE Mobile Application Getting Started This project is a starting point for a ThingsBoard PE Mobile application. A few resources to

Aug 16, 2022

Related

Application For GoIndiaStocks Internship(through Internshala)
 Application For GoIndiaStocks Internship(through Internshala)

Goindiastocks internship assignment - GoIndiaStocks Internship Application Assignment

Feb 6, 2022
A mobile travel app is a software application that has been developed specifically for use on smaller devices
A mobile travel app is a software application that has been developed specifically for use on smaller devices

A mobile travel app is a software application that has been developed specifically for use on smaller devices, such as smartphones and tablets, and can be used by business travellers to book and manage their travel whilst on the move

Apr 27, 2022
Travel-Application-Ui-design - A Simple Travel Application Ui design For Flutter
Travel-Application-Ui-design - A Simple Travel Application Ui design For Flutter

Flutter Simple Travel Application UI Design A part of #flutter100daysofcode. Let

Jan 28, 2022
gceditor - a client/server application for creating a persistent data of an application
gceditor - a client/server application for creating a persistent data of an application

gceditor - a client/server application for creating a persistent data of an application

Jul 13, 2022
Flutter demo application for Apple TV (tvos) using custom Flutter engine
Flutter demo application for Apple TV (tvos) using custom Flutter engine

Flutter for Apple TV A modification of the Flutter engine + test application to demonstrate that Flutter applications run on Apple TV This project (an

Jul 31, 2022
A Flutter application to demonstrate how to implement Google maps and its advanced options in a flutter app.
A Flutter application to demonstrate how to implement Google maps and its advanced options in a flutter app.

google_maps_flutter_example A new Flutter application to demonstrate how to implement flutter google maps in a flutter application and perfoem advance

May 23, 2022
A simple flutter application which explains razorpay payment gateway integration with flutter.
A simple flutter application which explains razorpay payment gateway integration with flutter.

A simple flutter application which explains razorpay payment gateway integration with flutter.

Oct 24, 2021
A new Flutter application. Frontend Side of project Rent a Car on Flutter
A new Flutter application. Frontend Side of project Rent a Car on Flutter

Rent a Car With Flutter A new Flutter application. Frontend Side of project Rent a Car on Flutter Upgraded to Flutter 2 and enabled Null Safety. Getti

Jan 17, 2022
This project is a starting point for a Flutter application.

result A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this i

Aug 24, 2021
(Complete flutter application) Exam and training app as social media, prepared with Firebase backend services, Bloc State management, Singleton design pattern, Unit and widget tests, firebase mocking, Custom local libraries, etc.
(Complete flutter application) Exam and training app as social media, prepared with Firebase backend services, Bloc State management, Singleton design pattern, Unit and widget tests, firebase mocking, Custom local libraries, etc.

(Complete flutter application) Exam and training app as social media, prepared with Firebase backend services, Bloc State management, Singleton design pattern, Unit and widget tests, firebase mocking, Custom local libraries, etc.

Jul 14, 2022