MediaPlayback constructor

MediaPlayback(
  1. Iterable<Uri> resources, {
  2. required WidgetBuilder onLoadFailed,
  3. WidgetBuilder? onLoading,
  4. MediaPlaybackPreference preference = const MediaPlaybackPreference(),
  5. Key? key,
})

Construct MediaPlayback with predefined preferences.

It should not be built during widget test due to behavourial of Dart's built in client. Therefore, UnsupportedError will be thrown if attempted to build it.

Implementation

MediaPlayback(Iterable<Uri> resources,
    {required this.onLoadFailed,
    this.onLoading,
    this.preference = const MediaPlaybackPreference(),
    super.key})
    : resources = List.unmodifiable(resources) {
  if (isTesting) {
    throw UnsupportedError(
        "No real network interaction allowed during test, and it should never be built.");
  }
}