audio_streams 1.0.0 copy "audio_streams: ^1.0.0" to clipboard
audio_streams: ^1.0.0 copied to clipboard

outdated

Support for Audio Streams in Flutter

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:audio_streams/audio_streams.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  AudioController controller;

  @override
  void initState() {
    super.initState();
    controller = new AudioController(CommonFormat.Int16, 16000, 1, true);
    initAudio();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initAudio() async {
    await controller.intialize();
    controller.startAudioStream().listen((onData){
      print(onData);
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
      ),
    );
  }
}