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:
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());
}
Challenges
Challenge 1: Connect to a WebSocket server
In this challenge, you will make a successful connection to the WebSocket API server.
- Locate
# TODO-1: Add packagein thepubspec.yamlfile and add the