import 'package:fis_ui/index.dart';
import 'package:flyinsono/architecture/router/desktop/routes.dart';
import 'package:flyinsono/architecture/router/mobile/routes.dart';
// import 'package:flyinsono/architecture/router/mobile/routes.dart';
import 'package:flyinsono/architecture/router/types.dart';
import 'router.dart';

export 'router.dart';
export 'desktop/names.dart';
export 'mobile/names.dart';
export 'transition.dart';

bool _hasInit = false;

/// 初始化路由
FRouter initRouter() {
  if (_hasInit)
    throw UnsupportedError(
        "Router has been init. Do not call this method twice.");
  List<FRouteSetting<dynamic>> routes;

  if (kIsMobile) {
    routes = FRoutesMobileBuilder().build();
  } else {
    routes = FRoutesDesktopBuilder().build();
  }

  router.setRoutes(routes);
  _hasInit = true;
  return router;
}
