createStory method

Future<StoryModel?> createStory({
  1. dynamic text,
  2. dynamic user,
  3. dynamic attachedUrl,
  4. dynamic type,
})

Implementation

Future<StoryModel?> createStory({text, user, attachedUrl, type}) {
  Log(
    logName: 'CreateStory',
    className: 'Story',
    methodName: 'createStory',
    type: 'INFO',
    text:
        '{event: Create Story, user: ${user?.userPayloadId.toString()}, user is ${user?.firstName.toString()} ${user?.lastName.toString()}, story info: attachedUrl- $attachedUrl, text- $text, type- $type',
  );
  return _httpService
      .createStory(
          text: text, attachedUrl: attachedUrl, user: user, type: type)
      .then((data) async {
    if (data.statusCode >= 200 && data.statusCode < 300) {
      var res = json.decode(data.body);
      StoryModel storyData = StoryModel.fromJson(res[0]);
      return storyData;
    }
    return null;
  });
}