Wrapper for https://www.radio-browser.info/

Documentation for the API can be found here

Features

Contains wrapper methods for the following endpoints:

  1. Stations
  2. Countries
  3. Languages
  4. Tags
  5. Codecs
  6. Server details

Getting started

Import the package:

import 'package:radio_browser_flutter/radio_browser_flutter.dart';

Initialize RadioBrowserClient before using it:

void main() {
  RadioBrowserClient.initialize(USER_AGENT);
  runApp(const MyApp());
}

Please keep the User-Agent descriptive as it helps the API maintainer. It can be something like <APP_NAME>/<APP_VERSION>.

Usage

Call the methods exposed by the API by using the client instance:

FutureBuilder(
        future: RadioBrowserClient.instance.codecs.fetch(),
        builder: ((context, AsyncSnapshot<List<Codec>> snapshot) {
          if (snapshot.connectionState == ConnectionState.waiting) {
            return const Center(child: CircularProgressIndicator());
          }
          if (snapshot.hasError) {
            return Text(snapshot.error?.toString() ?? "Something went wrong");
          }
          var data = snapshot.data!;
          return ListView.builder(
            itemCount: data.length,
            itemBuilder: ((context, index) {
              return ListTile(title: Text(data[index].name));
            }),
          );
        }),
      )