# v9.0

## v9.0 Migration Guide

This guide highlights the **breaking changes** introduced in v9.0 of the SDK. For questions or issues, file a [GitHub issue](https://github.com/GetStream/stream-chat-flutter/issues).

---

## Dependencies

To migrate to v9.0, update your `pubspec.yaml`:

```yaml
dependencies:
  stream_chat_flutter: ^9.0.0
```

## Breaking Changes

### Refactored `StreamAttachmentPickerController`

The `StreamAttachmentPickerController` has been restructured to improve flexibility and support additional use cases like poll management.

#### Key Changes

1. **Value Type Update:**
   - Previously managed a `List<Attachment>`.
   - Now manages an `AttachmentPickerValue` object, which includes:
     - `attachments`: A list of attachments.
     - `poll`: A new field for managing polls.

2. **Constructor Changes:**
   - Added a new `initialPoll` parameter to set the initial poll.
   - The `initialAttachments` parameter now initializes the `attachments` field within `AttachmentPickerValue`.

#### Class Comparison

**Old API:**

```dart
class StreamAttachmentPickerController extends ValueNotifier<List<Attachment>> {
  StreamAttachmentPickerController({
    List<Attachment>? initialAttachments,
    int maxAttachmentSize,
    int maxAttachmentCount,
  });
}
```

**New API:**

```dart
class StreamAttachmentPickerController extends ValueNotifier<AttachmentPickerValue> {
  StreamAttachmentPickerController({
    Poll? initialPoll,
    List<Attachment>? initialAttachments,
    int maxAttachmentSize,
    int maxAttachmentCount,
  });
}

class AttachmentPickerValue {
  const AttachmentPickerValue({
    this.poll,
    this.attachments = const [],
  });

  final Poll? poll;
  final List<Attachment> attachments;

  AttachmentPickerValue copyWith({
    Poll? poll,
    List<Attachment>? attachments,
  });
}
```

---

#### Migration Steps

##### Updating Controller Usage

- **Old Approach:** `List<Attachment>` manipulation.
- **New Approach:** Use `AttachmentPickerValue` and its `copyWith` method.

**Old Code:**

```dart
final attachments = controller.value;
controller.value = [...attachments, newAttachment];
```

**New Code:**

```dart
final attachments = controller.value.attachments;
controller.value = controller.value.copyWith(
  attachments: [...attachments, newAttachment],
);
```

##### Managing Polls

Polls are now supported through the `poll` field.

**Example:**

```dart
// Setting a new poll
controller.poll = pollObject;
```

---

For additional support, visit our [GitHub repository](https://github.com/GetStream/stream-chat-flutter/issues).


---

This page was last updated at 2026-04-23T18:43:04.350Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/flutter/v10/guides/migration_guide_9_0/](https://getstream.io/chat/docs/sdk/flutter/v10/guides/migration_guide_9_0/).