Verify that committed GeneratedPluginRegistrant are up-to-date (#13541)

This commit is contained in:
Michael Goderbauer
2017-12-13 17:49:54 -08:00
committed by GitHub
parent 998bf194a3
commit e5846d962e
13 changed files with 216 additions and 3 deletions

View File

@@ -7,5 +7,17 @@ import io.flutter.plugin.common.PluginRegistry;
*/
public final class GeneratedPluginRegistrant {
public static void registerWith(PluginRegistry registry) {
if (alreadyRegisteredWith(registry)) {
return;
}
}
private static boolean alreadyRegisteredWith(PluginRegistry registry) {
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
if (registry.hasPlugin(key)) {
return true;
}
registry.registrarFor(key);
return false;
}
}