Files
Lukas Klingsbo b283b82f6c refactor: Modernize switch; use switch-expressions and no break; (#3133)
Replaces the switch cases that can be replaces with switch expressions
and removes `break;` where it isn't needed.

https://dart.dev/language/branches#switch-statements
2024-04-18 23:41:08 +02:00

32 lines
997 B
Dart

import 'dart:html'; // ignore: avoid_web_libraries_in_flutter
import 'package:flutter/widgets.dart';
import 'package:tutorials_space_shooter/step1/main.dart' as step1;
import 'package:tutorials_space_shooter/step2/main.dart' as step2;
import 'package:tutorials_space_shooter/step3/main.dart' as step3;
import 'package:tutorials_space_shooter/step4/main.dart' as step4;
import 'package:tutorials_space_shooter/step5/main.dart' as step5;
import 'package:tutorials_space_shooter/step6/main.dart' as step6;
void main() {
var page = window.location.search ?? '';
if (page.startsWith('?')) {
page = page.substring(1);
}
return switch (page) {
'step1' => step1.main(),
'step2' => step2.main(),
'step3' => step3.main(),
'step4' => step4.main(),
'step5' => step5.main(),
'step6' => step6.main(),
_ => runApp(
Directionality(
textDirection: TextDirection.ltr,
child: Text('Error: unknown page name "$page"'),
),
),
};
}