planAuthSlate function
Builds the slate plan for an auth invocation. Pure: the only side effect
is calling prompt (which the runtime backs with CliDialog.ask()).
Returns null for an unsupported backend so the runtime can fall through
to its default branch.
Implementation
SlatePlan? planAuthSlate({
required String backend,
required Prompt prompt,
}) {
switch (backend) {
case 'Supabase':
final url = prompt(supabaseUrlPrompt);
final anonKey = prompt(supabaseAnonKeyPrompt);
final config = NySupabaseSlateConfig(url: url, anonKey: anonKey);
return SlatePlan(
packagesToAdd: const ['supabase_flutter'],
templates: supabaseRun(config),
config: config,
);
case 'Laravel':
// Trailing-slash trimming is handled by `NyLaravelSlateConfig.url`.
final config = NyLaravelSlateConfig(url: prompt(laravelUrlPrompt));
return SlatePlan(
packagesToAdd: const [],
templates: laravelRun(config),
config: config,
);
case 'Firebase':
return SlatePlan(
packagesToAdd: const [
'firebase_core',
'firebase_auth',
'cloud_firestore',
],
templates: firebaseRun(),
);
case 'Basic':
return SlatePlan(
packagesToAdd: const [],
templates: basicRun(),
);
default:
return null;
}
}