i've added a background isolate and it works fine on macOs and android, but as soon as i flutter run -d chrome
i.e. compile for web i get a compile time error:
[...] Error: Member not found:
'BackgroundIsolateBinaryMessenger.ensureInitialized'.
BackgroundIsolateBinaryMessenger.ensureInitialized(input.rootIsolateToken);
^^^^^^^^^^^^^^^^^
which makes sense since that's not supported in web
but how can i omit this when compiling for web, i tried this but it wont work:
if (!kIsWeb) {
// Register the background isolate with the root isolate.
// comiler still unhappy that this member doenst exist, but it should simply skip this block
BackgroundIsolateBinaryMessenger.ensureInitialized(input.rootIsolateToken);
}
i'm looking for a solution similar to C's #if
, #endif
is this a flutter bug or am i supposed to wrap the BackGroundIsolateBinaryMessenger in my own lib like described in this answer?
or can i somehow mark the if statement as const s.t. it gets evaluated at compile time?