Skip to content

Getting Started

Pablo Bautista edited this page May 31, 2020 · 4 revisions

Getting Started

You only need to add Flusmic in your pubspec.yaml file.

dependencies:
  flusmic_ui: <latest-version> /// latest version

Flusmic instance creation it's simple:

final flusmic = Flusmic(prismicEndpoint: <yourEndpoint>);

With optional 'defaultLanguage' and 'defaultAuthToken' params;

final flusmic = Flusmic(prismicEndpoint: <yourEndpoint>, 
    defaultLanguage: <defaultLang>, defaultAuthToken: <yourToken>);

There are 4 basic methods to start fetching data from Prismic.io:

API

For general prismic API information.

final api = await flusmic.getApi();

Root document

The main document containing all the prismic documents.

final response = await flusmic.getRootDocument();

Fetching documents by type

Fetching all the documents by a specific type using the slug.

final response = await flusmic.getDocumentsByType('typeSlug');

Fetching a document by id

Fetching a specific document by the document id

final response = await flusmic.getDocumentById('documentId');