FlarkSession constructor

FlarkSession({
  1. String markdown = '',
  2. Future<FlarkBackendLease> backendLoader()?,
  3. int? syncLimit,
  4. FlarkLiveLimits liveLimits = const FlarkLiveLimits(),
})

syncLimit is the UTF-8 size rendered live, flarkDefaultLiveBytes unless set; liveLimits bounds the document's shape. A document beyond either opens and edits in source mode. Limits no editor can apply throw an ArgumentError.

A markdown the editor cannot hold, with a bare CR or an unpaired surrogate or over the 1 MiB writable limit, does not throw: the session fails with the refusal as its error. loadMarkdown can then set other content for retryLoading to open.

Implementation

FlarkSession({
  String markdown = '',
  Future<FlarkBackendLease> Function()? backendLoader,
  int? syncLimit,
  this.liveLimits = const FlarkLiveLimits(),
}) : _markdown = markdown,
     _loader = backendLoader ?? loadFlarkBackend,
     syncLimit = syncLimit ?? flarkDefaultLiveBytes {
  checkFlarkLimits(
    syncLimit: this.syncLimit,
    sourceLimit: FlarkEditor.defaultSourceLimit,
    liveLimits: liveLimits,
  );
  _publish();
  _start();
}