openSnaps method

  1. @override
Future<void> openSnaps({
  1. required String userId,
  2. String? snapName,
  3. Iterable<String>? tags,
  4. int? snapId,
  5. String? token,
  6. StorifyMeEditorType editorType = StorifyMeEditorType.snaps,
})
override

Opens StorifyMe Snaps with the specified parameters.

userId: The user ID associated with StorifyMe Snaps. snapName: (Optional) The name of the snap. tags: (Optional) An iterable of tags associated with the snap. snapId: (Optional) ID of an existing snap to edit. When provided, the editor loads that snap instead of creating a new one. Requires token. token: (Optional) Auth token generated by the StorifyMe API for this user. Required when snapId is provided. editorType: (Optional) Type of the editor to open. Defaults to StorifyMeEditorType.snaps.

Implementation

@override
Future<void> openSnaps({
  required String userId,
  String? snapName,
  Iterable<String>? tags,
  int? snapId,
  String? token,
  StorifyMeEditorType editorType = StorifyMeEditorType.snaps,
}) async {
  final map = <String, dynamic>{};
  map[Params.USER_ID] = userId;
  map[Params.SNAP_NAME] = snapName;
  map[Params.TAGS] = tags;
  map[Params.EDITOR_TYPE] = editorType.value;
  if (snapId != null) {
    map[Params.SNAP_ID] = snapId;
  }
  if (token != null) {
    map[Params.TOKEN] = token;
  }
  await methodChannel.invokeMethod<void>(Method.OPEN_SNAPS, map);
}