StreamProvider.value with catchError

459 views
Skip to first unread message

Chris O'Donnell

unread,
Jul 9, 2019, 1:28:28 AM7/9/19
to Flutter Development (flutter-dev)
Hi,

I am using StreamProvider.value, but am struggling to find any examples online of how to use the "catchError" property! I have the official documentation, but can't manage to link this to a real world example. 

I was wondering if you could show me how to implement a "catchError" property below in yellow. See example code.

StreamProvider<LocationModelNormal>.value(
    initialData: LocationModelNormal.initialData(),
    stream: locationStreamInstance.specificLocation(_secondWonder),
    catchError: ?????????
),
class LocationModelNormal {
  final String name;
  LocationModelNormal({
    this.name
  });
  factory LocationModelNormal.fromMap(Map<String, dynamic> data) {
    return LocationModelNormal(
      name: data['name'] ?? '',

    );
  }
  factory LocationModelNormal.initialData() {
    return LocationModelNormal(
      name: '',
    );
  }
}
Reply all
Reply to author
Forward
0 new messages