
# Moving to 0.8

Release 0.8 moves the Flutter starters to Flutter 3.50, which takes Material and Cupertino out of the SDK. The Flutter starter follows and keeps no design library; Material and Cupertino come with two new starters (see [Design libraries](design-libraries.md)). An app of type `material` or `cupertino` adds its starter and rebuilds; its look does not change, except that its page changes now animate as in Flutter ([step 9](#9-page-transitions)). The steps below are for Flutter apps; a server on the pure Dart packages stays on Dart 3.13 and changes nothing for this.

## 1. Flutter 3.50

The Flutter packages (`spring_boot_starter_flutter`, `_navigation`, `_security`, `_material`, `_cupertino`) need Flutter 3.50 or later, with Dart 3.14:

```yaml
# pubspec.yaml
environment:
  sdk: ^3.14.0
  flutter: '>=3.50.0'
```

```bash
flutter upgrade
```

## 2. The design starter

An app of `spring.flutter.app.type: material` adds the Material starter and `material_ui`; one of type `cupertino` the Cupertino starter and `cupertino_ui`. The design starter brings the Flutter starter, so it may replace it in the dependencies:

```yaml
# pubspec.yaml of a Material app
dependencies:
  flutter:
    sdk: flutter
  material_ui: ^1.11.0
  spring_boot_starter_flutter_material: ^0.9.0
```

```yaml
# pubspec.yaml of a Cupertino app
dependencies:
  flutter:
    sdk: flutter
  cupertino_ui: ^1.1.6
  spring_boot_starter_flutter_cupertino: ^0.9.0
```

An app with the security starter keeps it and adds the design starter next to it. An app of type `widgets` adds nothing. Without its starter, `material` or `cupertino` fails the start and names the package.

`spring.flutter.app.type` may now be dropped when the app uses one design starter: as Spring Boot deduces the web application type from the class path, the starter decides, and the app is of type `material` or `cupertino` without the line. An app that keeps it is unchanged. An app that lists both design starters (Material on Android, Cupertino on iOS) keeps the type, for every platform and in the profile of each platform that differs: without it the start fails, naming the property and the types. See [The type when not set](app-widget.md#the-type-when-not-set).

## 3. The imports

`package:flutter/material.dart` and `package:flutter/cupertino.dart` are deprecated in Flutter 3.50. Let `dart fix` rewrite them to `package:material_ui/material_ui.dart` and `package:cupertino_ui/cupertino_ui.dart`, with only that fix:

```bash
dart fix --apply --code=deprecated_member_use
```

**Do not run the bare `dart fix --apply`.** It also applies `missing_dependency`, which adds the packages it finds imported to `pubspec.yaml` with the constraint `any`. Add `material_ui` or `cupertino_ui` by hand, with a version, as in step 2.

Where the app imported a starter only for Material's types, import the design starter: `ThemeCustomizer`, `MaterialThemes` and `SpringThemeExtension` are in `package:spring_boot_starter_flutter_material/spring_boot_starter_flutter_material.dart`, `CupertinoThemeCustomizer` and `CupertinoThemes` in `package:spring_boot_starter_flutter_cupertino/spring_boot_starter_flutter_cupertino.dart`. The design starter's import exports the Flutter starter too.

## 4. The app type is a text

The enum `AppType` is gone. `spring.flutter.app.type` is unchanged in the configuration files (and may be left out with one design starter, see step 2); in code, `FlutterAppSettings.type` is a `String`:

```dart
// 0.7
if (app.type == AppType.material) { ... }

// 0.8
if (app.type == 'material') { ... }
```

## 5. MaterialThemes instead of SpringThemes.material

`SpringThemes.material(name)` and `SpringThemes.cupertino(name)` are gone; the themes as Material's and Cupertino's are beans of the design starters:

```dart
// 0.7
final theme = springThemes.material('ocean');

// 0.8: inject MaterialThemes (a widget: SpringStatelessWidget<(MaterialThemes,)>)
final theme = materialThemes.theme('ocean');

// or, with the application context at hand
final theme = MaterialThemes.of(applicationContext).theme('ocean');
```

The same for Cupertino: `cupertinoThemes.theme('ocean')`. The customizers and the replacing beans (`ThemeData` beans named `theme` and `darkTheme`, a `CupertinoThemeData` bean) work as before, from the design starters.

## 6. The palette class

`SpringThemeData.colorScheme` is a `SpringColorScheme`, the Flutter starter's own palette class, not Material's `ColorScheme`. It has the same 46 roles under the same names, so code that reads roles (`theme.colorScheme.primary`) compiles as it is. Code that needs Material's class takes `toMaterial().colorScheme`, or `materialColorScheme`, from the Material starter. `toMaterial()`, `visualDensity`, `tapTargetSize`, `splashFactory`, `toCupertino()`, `cupertinoPrimaryColor` and `cupertinoProperties` are extension members of the design starters now: the starter's import brings them back.

## 7. LoginDesign

In the security starter, `LoginDesign.material` and `LoginDesign.cupertino` are gone. `LoginDesign.app` draws with the controls of the app's design starter (Material's or Cupertino's, as before); `LoginDesign.widgets` draws the plain widgets:

```dart
// 0.7
LoginForm(design: LoginDesign.material)

// 0.8
LoginForm(design: LoginDesign.app)   // or leave design out: the app's is the default
```

## 8. A seed in an app without a design

`seed-color`, `scheme-variant` and `contrast` need a design starter, which has Material 3's palette algorithm. In an app of type `widgets` a theme with them now fails the start. Either add a design starter, or write the roles under `colors.*`:

```yaml
# 0.7
spring.flutter.theme:
  seed-color: teal

# 0.8, in an app without a design library
spring.flutter.theme:
  colors:
    primary: '#006A6A'
    on-primary: '#FFFFFF'
    primary-container: '#9CF1F0'
    surface: '#F4FBFA'
    # ... every role the app uses; the others are the baseline
```

The repository's neon theme did this: it names all its roles under `colors.*` and has no `seed-color`.

The properties of a design (`components.*`, `visual-density`, `tap-target-size`, a single-value `splash`, `cupertino.*`) stay accepted without their starter: not shown, as before, and no longer checked; the log names the starter that reads each. The page transitions `zoom` and `cupertino` need their starter.

## 9. Page transitions

Material and Cupertino apps now animate page changes. A theme without `motion.page-transition` had no transition, in every app type; now it is `platform`, the app type's own, as in Flutter: Material's per platform in a `MaterialApp`, the iOS slide with its swipe back in a `CupertinoApp`. An app without a design library still switches pages at once. To keep instant pages, write `none`:

```yaml
spring.flutter.theme.motion.page-transition: none
```

A screen or a navigation that chose its own (`@ScreenRoute(transition:)`, `go(path, transition:)`) keeps it. See [Transitions](../spring-boot-starter-flutter-navigation/transitions.md#as-in-flutter-and-where-it-differs) for why the default changed.

## 10. Android

Flutter 3.50 refuses an Android app on an Android Gradle Plugin older than 9.1.1. Raise it in `android/settings.gradle.kts` (the security starter's plugin builds with 9.3.1, the version of Flutter 3.50's template), and the Gradle wrapper to the recommended 9.5.0:

```kotlin
// android/settings.gradle.kts
plugins {
    id("com.android.application") version "9.3.1" apply false
}
```

```properties
# android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip
```

## 11. Regenerate

```bash
dart run build_runner build --delete-conflicting-outputs
```

The generator finds the design starter and writes its beans and its design into `lib/spring_gen/main.spring.dart`. The typed keys are written under new names (`theme.spring.keys.dart`, `messages.spring.keys.dart`, `json_schemas.spring.classes.dart`); they are parts of the generated library, so no import changes, and the build removes the old files.

## See also

- [Design libraries](design-libraries.md)
- [spring_boot_starter_flutter_material](../spring-boot-starter-flutter-material/index.md)
- [spring_boot_starter_flutter_cupertino](../spring-boot-starter-flutter-cupertino/index.md)
- [Login screens](../spring-boot-starter-flutter-security/login-screens.md)
