init method

  1. @override
Future<PlatformInitResult> init(
  1. GromoreConfig config
)
override

初始化 SDK

config 初始化配置

Implementation

@override
/// 初始化 SDK
///
/// [config] 初始化配置
Future<PlatformInitResult> init(GromoreConfig config) async {
  updateEnabledAdTypes(config.enabledAdTypes);
  final Map<dynamic, dynamic>? result = await methodChannel
      .invokeMethod<Map<dynamic, dynamic>>('init', config.toMap());
  if (result == null) {
    return const PlatformInitResult.failure(
      errorCode: 'init_failed',
      errorMessage: 'Init returned null.',
    );
  }
  return PlatformInitResult.fromMap(result);
}