Flutter Task 4 Stream builder + Linux App

Simran Lodhi
4 min readNov 3, 2020

What is Linux ?

Linux is an open source operating system (OS). An operating system is the software that directly manages a system’s hardware and resources, like CPU, memory, and storage.

Task Description:

  1. Create an app that can run any linux command using App.
  2. Output will be saved in firestore.
  3. From firestore, get this output and print on screen.
  4. Use Stream Builder to save data.

Following steps are required to connect our app to goggle Firestore.

Step1: Create a Firebase project.

Step 2: Register your app with firebase.

Step3: Add a firebase configuration file.

Step4: Add Flutter Fire plugins

For getting more information about steps visit the following website:

Here is the over view of the app that we are going to make now-

After adding your app to the firebase you have to provide some dependencies which can help your app to connect to the firebase. Your have to provide these dependencies to pubspec.yaml file. You can download these dependencies from pub.dev.

For running the linux command from our app we have to create a python file which helps us to interact with linux and get the output from it.

In my Linux integrated app I have created a Home screen which provide the option like login and registration for user. Home Screen look like:

In Registration screen user have to give his email and password after submitting he will we redirecting to Terminal.

In login screen user have to provide the same email and password as he provided in registration.

After giving all the information the user redirects to terminal screen from where he/she can run the command.

What is Stream builder?

Stream Builder is a Widget that can convert a stream of user defined objects, to widgets. This takes two arguments. A stream. A builder, that can convert the elements of the stream to widgets. A Stream provides a way to receive a sequence of events. Each event is either a data event, also called an element of the stream, or an error event, which is a notification that something has failed. When a stream has emitted all its event, a single “done” event will notify the listener that the end has been reached.

A Stream Builder Widget is a StatefulWidget, and so is able to keep a ‘running summary’ and or record and note the ‘latest data item’ from a stream of data.

So the following picture shows how to apply stream builder in our app.

When user runs the if config commands the output from the linux server prints on the app.

The similar output store the firebase and with the use of stream builder we can get the data open in the debug console.

The github link for the code:

--

--