Platform constructor
Platform()
Implementation
factory Platform() {
final platformNode = Settings.map['platform'];
final name = switch (platformNode) {
final String e => e,
{'name': final String e} => e,
_ => throw const _PlatformSettingsError(),
};
try {
switch (name) {
case 'feishu':
return Feishu(
appId: platformNode['app_id'],
appSecret: platformNode['app_secret'],
spreadsheetToken: platformNode['spreadsheet_token'],
);
}
} catch (e) {
throw _PlatformSettingsError(name);
}
throw UnimplementedError('Unsupported platform: $name');
}