You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 12, 2022. It is now read-only.
Wouldn't make sense to use the Facade design pattern to extract the external calls for a separated class and import that class on the other dart code that uses it. The logic behind it to call the C function is ugly and extracting for a single class would make your code better.
class OpenMtpLookupFacade {
final DynamicLibrary dyLib;
const OpenMtpLookupFacade() {
dyLib = DynamicLibrary.open(libraryPath);
}
void openModFile(String file) {
final OpenModFile openModFileC = dyLib.lookup<NativeFunction<openModFile_native>>('open_mod_file').asFunction();
openModFileC(file.toNativeUtf8());
}
}
and in the other places:
final openMtp = OpenMtpLookupFacade();
openMtp.openModFile(myFancyString);
For the clients of this class the FFI is totally transparent, they won't know you're calling C :D
Wouldn't make sense to use the Facade design pattern to extract the external calls for a separated class and import that class on the other dart code that uses it. The logic behind it to call the C function is ugly and extracting for a single class would make your code better.
and in the other places:
For the clients of this class the FFI is totally transparent, they won't know you're calling C :D
dart-mod-player/lib/dart_openmpt.dart
Line 62 in 12e885d
The text was updated successfully, but these errors were encountered: