# Remove the example code (optional)

https://docs.serverpod.dev/get-started/remove-the-example-code

Your project still contains the greeting example that `serverpod create` generated. Your app no longer uses it. Remove the example before you deploy, so you ship only the code your app uses.

The example is spread across the Flutter app and the server, and those pieces depend on each other. Follow the steps below in order, and keep `serverpod start` running from the previous page.

## Delete the example from the app

Your recipe screen uses the `ResultDisplay` widget, which is defined in `greetings_screen.dart`. Move the widget into its own file before you delete the screen.

1. Create `magic_recipe_flutter/lib/widgets/result_display.dart`:

   ```dart
   import 'package:flutter/material.dart';

   /// Shows the result of a server call, or an error message if the call failed.
   class ResultDisplay extends StatelessWidget {
     final String? resultMessage;
     final String? errorMessage;

     const ResultDisplay({super.key, this.resultMessage, this.errorMessage});

     @override
     Widget build(BuildContext context) {
       final colors = Theme.of(context).colorScheme;

       String text;
       Color backgroundColor;
       Color foregroundColor;
       if (errorMessage != null) {
         backgroundColor = colors.errorContainer;
         foregroundColor = colors.onErrorContainer;
         text = errorMessage!;
       } else if (resultMessage != null) {
         backgroundColor = colors.primaryContainer;
         foregroundColor = colors.onPrimaryContainer;
         text = resultMessage!;
       } else {
         backgroundColor = colors.surfaceContainerHighest;
         foregroundColor = colors.onSurfaceVariant;
         text = 'No server response yet.';
       }

       return Container(
         constraints: const BoxConstraints(minHeight: 60),
         width: double.infinity,
         padding: const EdgeInsets.all(16),
         // Reuses the text field's border so the shape and width always match.
         decoration: ShapeDecoration(
           color: backgroundColor,
           shape: OutlineInputBorder(
             borderSide: BorderSide(color: foregroundColor),
           ),
         ),
         child: Center(
           child: Text(text, style: TextStyle(color: foregroundColor)),
         ),
       );
     }
   }
   ```

2. In `recipe_screen.dart`, replace the `greetings_screen.dart` import with the new file:

   ```dart
   import '../widgets/result_display.dart';
   ```

3. In `magic_recipe_flutter/lib/main.dart`, remove the `greetings_screen.dart` import:

   ```dart
   import 'screens/greetings_screen.dart';
   ```

4. In the same file, the comment below `body: const RecipeScreen(),` shows how to turn on the sign-in screen that comes with [authentication](https://docs.serverpod.dev/concepts/authentication/get-started.md), but it wraps `GreetingsScreen`, which you're about to delete. Replace the comment so it wraps your recipe screen instead:

   ```dart
         body: const RecipeScreen(),
         // To require sign-in, import 'screens/sign_in_screen.dart' and replace
         // the line above with the line below. SignInScreen shows a sign-in UI
         // until the user is authenticated, then shows its child. To let users
         // sign out, call client.auth.signOutDevice() from your UI, for
         // example from a button in the app bar.
         //
         // body: const SignInScreen(child: RecipeScreen()),
   ```

5. Delete `magic_recipe_flutter/lib/screens/greetings_screen.dart`.

The app hot reloads and looks the same as before.

## Delete the example from the server

1. In `magic_recipe_server`, delete the example's model, endpoint, and test:

   - `lib/src/greetings/`
   - `test/integration/greeting_endpoint_test.dart`

   The test calls the greeting endpoint, which means it can't stay once the endpoint is gone. It was the project's only test, and the generated test workflow on GitHub fails until you [write a test](https://docs.serverpod.dev/concepts/testing/get-started.md) of your own.

2. Wait for `serverpod start` to regenerate your code, which removes the greeting endpoint from the client.

3. In the `serverpod start` terminal, press **R** to hot restart. As on the previous pages, a change to the generated client needs a hot restart.

The app still looks the same.

## Next steps

With the greeting example gone, you're ready to [deploy the app](https://docs.serverpod.dev/get-started/deployment.md) to Serverpod Cloud.
