implement overrideForAll and overrideFor

This commit is contained in:
Naveen Gattu 2019-12-24 15:30:15 -08:00 committed by GitHub
parent e983e4da63
commit b928e34a11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -86,7 +86,9 @@ class OpenDynamicLibrary {
///
/// When using the asynchronous API over isolates, [open] __must be__ a top-
/// level function or a static method.
void overrideFor(OperatingSystem os, OpenLibrary open) {}
void overrideFor(OperatingSystem os, OpenLibrary open) {
_overriddenPlatforms[os] = open;
}
/// Makes `moor_ffi` use the [OpenLibrary] function for all Dart platforms.
/// If this method has been called, it takes precedence over [overrideFor].
@ -94,5 +96,7 @@ class OpenDynamicLibrary {
///
/// When using the asynchronous API over isolates, [open] __must be__ a top-
/// level function or a static method.
void overrideForAll(OpenLibrary open) {}
void overrideForAll(OpenLibrary open) {
_overriddenForAll = open;
}
}