platform library

The parts that go through the platform: keeping the app serving and driving a TV while it isn't in front, Android's multicast lock and VPN check, and iOS's DLNA search. Its own library, one of the two that need Flutter (the other is airplay.dart): tv_cast.dart stays plain Dart, so scripts such as example/cast_file.dart run with dart run.

Classes

CastKeepAlive
Keeps the app serving and driving a TV while it isn't in front: on Android a media playback foreground service with a notification and its controls, a partial wake lock and a Wi-Fi lock; on Windows a power request, so the PC doesn't sleep under the TV. Nothing elsewhere.
CastNotice
What the system shows while a TV plays, in the app's own words: a title, a line, whether it plays (which control the notification offers), and the controls' and the notification group's names.
MethodChannelCastKeepAlive
CastKeepAlive over the plugin's channel, tv_cast/keep_alive.
MulticastLock
Android's Wi-Fi multicast lock: many phones drop multicast, and some the answers to it, while their Wi-Fi saves power. Held while searching for TVs; nothing elsewhere.
NativeSsdpSearch
The DLNA search over iOS's own sockets: the M-SEARCH to the multicast group and to every neighbour on the Wi-Fi directly, which iOS allows without Apple's multicast entitlement. Native because Dart closes a socket at its first refused send, and iOS refuses sends to a neighbour that didn't answer lately. The answers come at the end, read here; none off iOS or off any Wi-Fi.
TvCastDartPlugin
The plugin on Linux and macOS, where it has no native code: Flutter calls registerWith at startup, which points CastKeepAlive.instance at its no-op version. Finding and driving TVs and the relay are pure Dart and need nothing here; MulticastLock and NativeSsdpSearch already answer that they have nothing to do, and VpnCheck reads the adapters' names.
UnsupportedCastKeepAlive
CastKeepAlive where the platform has nothing to hold (Linux, macOS): hold is false, the rest does nothing, and no control is ever pressed. Casting goes on as long as the app runs.
VpnCheck
Whether a VPN stands between this device and the TVs. Android says, and tries the Wi-Fi around the VPN to tell a locked one; elsewhere the adapters' names are the guess.

Enums

CastAction
A control pressed outside the app: the notification's.