# Blur the background in Flutter

> Apply a compatible authored background-blur package to NosmaiCameraPreview and remove it without rebuilding the camera.

> For AI agents: the complete documentation index is at https://nosmai.com/llms/effects.txt

Product: Nosmai Effects
Group: guide
Source: https://nosmai.com/docs/effects/guides/background/blur-the-background/flutter/

## Prerequisites

- A working [Flutter quickstart](/docs/effects/quickstart/flutter/)
- A compatible background-blur `.nosmai` package

## Apply the blur package

The current public Dart model exposes color, image, and video constructors for
manual background replacement. Use an authored `background` package for blur:

```dart
final backgrounds =
    await NosmaiFlutter.instance.getLocalBackgrounds();
final blur = backgrounds.firstWhere(
  (item) => item.name == 'background_blur',
);

await NosmaiFlutter.instance.applyEffect(blur.path);
```

Use the actual name or identifier supplied with your package. Do not hard-code
`background_blur` unless that is the asset shipped by the application.

## Remove it

```dart
await NosmaiFlutter.instance.removeEffect(blur);
```

## Verify it worked

The subject should stay visible while the authored package blurs the
background. The same preview widget must remain mounted.

## Common errors

| Symptom | Fix |
| --- | --- |
| Local list is empty | Confirm the package is bundled and refresh local filter discovery |
| `applyEffect` returns `false` | Use the discovered local path and verify the package against the native release |
| Blur package replaces another background | This is expected because both use the background slot |

## Next steps

- [Replace the background in Flutter](/docs/effects/guides/background/replace-the-background/flutter/)
- [Bundle an Asset Store filter in Flutter](/docs/effects/guides/filters/bundle-an-asset-store-filter/flutter/)

## References

- [Filters and effects](/docs/effects/concepts/filters-and-effects/)
- [Flutter platform guide](/docs/effects/platforms/flutter/)
