Story class

The main class for the GladStoriesEngine.

Contains everything needed to create, update, save, restore the interactive fiction. The Story instance has the necessary metadata of the book saved in the instance propertires.

Constructors

Story({required String title, required String description, required String authors, required Page root, required Page currentPage, List<HistoryItem>? existingHistory, required int year, ImageResolver? imageResolver})

Properties

authors String
The list of authors separated by the comma
getter/setter pair
currentPage Page
The current Page of the Story.
getter/setter pair
description String
The description of the book
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
history List<HistoryItem>
List of the nodes and choices already done by the player.
getter/setter pair
historyChanges Stream<List<HistoryItem>>
A stream with the full list of history.
getter/setter pair
imageResolver ImageResolver?
A reference to the function to transform ImageType from enum into real image paths on the device. By default the Story constructor will use BackgroundImage class included in this library.
getter/setter pair
root Page
The starting Page of the interactive Story.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title String
The title of the book
getter/setter pair
year int
The year in which the interactive fiction story took place
getter/setter pair

Methods

canContinue() bool
Checks whether the currentPage has the next node.
convertToMarkDown(String imagePrefix) MarkdownDocument
Converts the story into MarkdownDocument
dispose() → dynamic
doContinue() → void
Jump to the next node (passage) on the current page.
findParentOfPage(Page page) Page?
Finds the parent page of the provided page.
goToNextPage(PageNext next) → void
Used to jump to the next page based on the Player's choice.
goToNextPageByText(String? optionText) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Makes the read Story to be unread again.
toJson() Map<String, dynamic>
Serializes the Story without the state and currentPage to the Map.
toMarkdownString(String imagePrefix) String
Converts Story into valid markdown string.
toStateJson() Map<String, dynamic>
Serializes the Story with the state, history and the currentPage to the Map.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromJson(Map<String, dynamic> map, {ImageResolver? imageResolver}) Story
Initializes the story from the input json.
generate() Story
Generates dummy story just to get started.