players property

Future<List<RemoteMediaPlayer>> players

Implementation

static Future<List<RemoteMediaPlayer>> get players async {
  try {
    await _channel.invokeMethod('startDiscoveryController');
    await Future.delayed(Duration(seconds: 3));
  } on PlatformException catch (e) {
    print('error starting discovery: ${e.details}');
  }
    print('THIS SHOULD PRINT AFTER 3 SEC');
  List<dynamic> players;
  try {
    players = await _channel.invokeMethod('getPlayers');
    print('PLAYERS: ${players.toString()}');
  } on PlatformException catch (e) {
    print('players fetch error: ${e.details}');
  }
  return players != null
      ? players.map(RemoteMediaPlayer.fromJson).toList()
      : List();
}