Search⌘ K
AI Features

Challenge: Real-Time Bitcoin Transactions

Explore connecting your Flutter app to a WebSocket server to receive real-time Bitcoin transaction data. Learn how to establish a connection, subscribe to transaction streams, process incoming JSON data, and close the connection properly. By completing this challenge, you will enhance your networking skills in Flutter and gain practical experience handling live data streams.

Goal

In this challenge, you’ll listen to Bitcoin transactions from the WebSocket API server and practice what you’ve learned previously.

Specs

When you run your app and navigate to “Realtime Transactions,” a list of transactions streams in, as shown below:

Bitcoin transaction challenge specs
Bitcoin transaction challenge specs

Starter code

Before you begin the challenge, look at the starter code below and run it. Once done, you can dive into the challenges below.

import 'package:flutter/material.dart';
import 'presentation/my_app.dart';
void main() async{
  runApp(const MyApp());
}


Bitcoin transaction challenge starter code

Challenges

Challenge 1: Connect to a WebSocket server

In this challenge, you will make a successful connection to the WebSocket API server.

  1. Locate # TODO-1: Add package in the pubspec.yaml file and add the
...