InvergeDocs
FlutterAPI reference

In-app messages

In-app messages in the Flutter SDK.

import 'package:nexus_flutter/nexus.dart';
SymbolKindSummary
NexusInAppclassIn-app messages (OneSignal-style).
NexusInAppActionclassEmitted when a user taps a button on an in-app message.
NexusInAppButtonclassA button on an in-app message.
NexusInAppMessageclassAn in-app message the SDK can display (modal / banner / center / fullscreen).
NexusInAppDesignclassThe designed look of an in-app message — built in the Nexus console's designer and delivered as content.design.
NexusInAppFrameclass
NexusInAppCloseclass
NexusInAppTapclassWhat tapping an image does.
NexusInAppBlocksealed classOne block of a designed message.
NexusInAppImageBlockclass
NexusInAppBadgeBlockclass
NexusInAppHeadingBlockclass
NexusInAppTextBlockclass
NexusInAppButtonsBlockclass
NexusInAppCarouselBlockclassA swipeable row of up to 10 cards.
NexusInAppCarouselCardclass
NexusInAppSpacerBlockclass
NexusInAppDividerBlockclass
NexusInAppDesignButtonclass
NexusInAppViewclassDefault rendering for an in-app message.
NexusInAppDesignedViewclassRenders a message designed in the Nexus console: backdrop, placement for the layout, entrance animation, auto-dismiss, and the block stack.
NexusInAppBuildertypedefBring your own in-app message UI.
NexusInAppOverlayclassHosts the currently-active in-app message above your app.

NexusInApp

class

In-app messages (OneSignal-style). Fetches the messages meant for this user — the server applies the audience, assigns the A/B variant and fills in {{variables}} — then evaluates triggers (session start / custom event) and frequency caps locally, requests display, and reports impressions/clicks. Rendering is done by NexusInAppOverlay (default UI) or your own widget driven by current.

View source

active

property
List<NexusInAppMessage> get active

All active in-app messages for the tenant.

View source

current

field
final ValueNotifier<NexusInAppMessage?> current

The message currently requested to display (null when none). The overlay listens to this.

View source

onAction

field
void Function(NexusInAppAction action)? onAction

Called when a user taps a button (handle url / event actions yourself, e.g. navigate or launchUrl). Event-action buttons are also auto-tracked.

View source

onTrackEvent

field
void Function(String event)? onTrackEvent

Wired by the SDK to the analytics track() for event-action buttons.

View source

setProperties()

method
Future<void> setProperties(Map<String, Object?> properties, {bool refetch = true})

Properties for audience targeting and personalisation, on top of the identify traits: setProperties({'plan': 'pro', 'coupon': 'SARA20'}) matches the console's plan conditions and fills {{coupon}}. Kept for this launch; pass refetch: false to wait for the next fetch.

Parameters

Prop

Type

View source

clearProperties()

method
void clearProperties([Iterable<String>? keys])

Remove properties set with setProperties.

Parameters

Prop

Type

View source

attachRealtime()

method
void attachRealtime(NexusRealtime realtime)

Wired by the SDK so a registered test device gets console tests instantly.

Parameters

Prop

Type

View source

fetch()

method
Future<List<NexusInAppMessage>> fetch()

Fetch the active messages; on success, auto-show a session-start message.

Returns Future<List<NexusInAppMessage>>

View source

onEvent()

method
void onEvent(String name)

Called when an analytics event fires — shows a message triggered by it.

Parameters

Prop

Type

View source

show()

method
void show(NexusInAppMessage m)

Show a specific message now (bypasses trigger, still respects frequency).

Parameters

Prop

Type

View source

tapButton()

method
void tapButton(NexusInAppMessage m, NexusInAppButton b)

Handle a button tap: report the click, surface the action, auto-track event actions, copy copy values, then dismiss. Tappable images in a designed message come through here too, with the image block's id.

Parameters

Prop

Type

View source

dismiss()

method
void dismiss(NexusInAppMessage m)

Dismiss the current message (X / backdrop tap).

Parameters

Prop

Type

View source

close()

method
void close()

Clear the message from the screen.

View source

dispose()

method
void dispose()
View source

NexusInAppAction

class

Emitted when a user taps a button on an in-app message.

View source

NexusInAppAction

constructor
const NexusInAppAction({required this.messageId, required this.buttonId, required this.action, this.url, this.event, this.value, this.variantId})

Parameters

Prop

Type

View source

messageId

field
final String messageId
View source

variantId

field
final String? variantId

The A/B variant the tap happened in, if any.

View source

buttonId

field
final String buttonId
View source

action

field
final String action

dismiss | url | event | copy.

View source

url

field
final String? url
View source

event

field
final String? event
View source

value

field
final String? value

For copy: the text that was put on the clipboard.

View source

NexusInAppButton

class

A button on an in-app message.

View source

NexusInAppButton

constructor
const NexusInAppButton({required this.id, required this.text, required this.action, this.url, this.event, this.style, this.value})

Parameters

Prop

Type

View source

NexusInAppButton.fromJson

factory
NexusInAppButton.fromJson(Map<String, dynamic> j)

Parameters

Prop

Type

View source

id

field
final String id
View source

text

field
final String text
View source

action

field
final String action

dismiss | url | event | copy (designed messages only).

View source

url

field
final String? url
View source

event

field
final String? event
View source

value

field
final String? value

For copy: the text to put on the clipboard.

View source

style

field
final String? style

primary | secondary | text.

View source

NexusInAppMessage

class

An in-app message the SDK can display (modal / banner / center / fullscreen).

View source

NexusInAppMessage

constructor
const NexusInAppMessage({required this.id, required this.layout, this.title, this.body, this.imageUrl, this.backgroundColor, this.textColor, this.buttons = const [], this.triggerType, this.triggerEvent, this.maxDisplays, this.perSession = false, this.design, this.variantId, this.isTest = false})

Parameters

Prop

Type

View source

NexusInAppMessage.fromJson

factory
NexusInAppMessage.fromJson(Map<String, dynamic> j)

Parameters

Prop

Type

View source

id

field
final String id
View source

layout

field
final String layout

modal | bottom_sheet | banner_top | banner_bottom | center | fullscreen.

View source

title

field
final String? title
View source

body

field
final String? body
View source

imageUrl

field
final String? imageUrl
View source

backgroundColor

field
final String? backgroundColor
View source

textColor

field
final String? textColor
View source

buttons

field
final List<NexusInAppButton> buttons
View source

triggerType

field
final String? triggerType

session_start | event (null = show on fetch).

View source

triggerEvent

field
final String? triggerEvent
View source

maxDisplays

field
final int? maxDisplays
View source

perSession

field
final bool perSession
View source

design

field
final NexusInAppDesign? design

The look designed in the console. Null for messages made before the designer — those render from title / body / imageUrl / buttons.

View source

variantId

field
final String? variantId

The A/B variant this user was assigned (null when the message has no test).

View source

isTest

field
final bool isTest

A "send test" from the console: shown at once, outside triggers and caps, never reported.

View source

NexusInAppDesign

class

The designed look of an in-app message — built in the Nexus console's designer and delivered as content.design.

A vertical stack of blocks inside a styled frame. The backend validates and clamps every value before it is stored, so parsing here is lenient: anything missing falls back to the console's defaults, and an unknown block type is skipped rather than failing the whole message.

View source

NexusInAppDesign

constructor
const NexusInAppDesign({required this.blocks, required this.frame, required this.overlayColor, required this.dismissOnBackdropTap, required this.close, required this.animation, required this.autoDismissSeconds, required this.direction})

Parameters

Prop

Type

View source

tryParse()

static method
static NexusInAppDesign? tryParse(Object? raw)

Parameters

Prop

Type

Returns NexusInAppDesign?

View source

blocks

field
final List<NexusInAppBlock> blocks
View source

frame

field
final NexusInAppFrame frame
View source

overlayColor

field
final Color overlayColor

Backdrop colour, opacity included (modal / sheet / center only).

View source

dismissOnBackdropTap

field
final bool dismissOnBackdropTap
View source

close

field
final NexusInAppClose close
View source

animation

field
final String animation

fade | slide | zoom | none.

View source

autoDismissSeconds

field
final int autoDismissSeconds

0 = stays until dismissed.

View source

direction

field
final String direction

auto | ltr | rtl.

View source

resolveDirection()

method
TextDirection resolveDirection(TextDirection ambient)

auto follows the copy: right-to-left when the first strong character is Arabic / Hebrew script — the same rule the console preview uses.

Parameters

Prop

Type

Returns TextDirection

View source

NexusInAppFrame

class View source

NexusInAppFrame

constructor
const NexusInAppFrame({required this.background, required this.background2, required this.backgroundKind, required this.gradientAngle, this.backgroundImageUrl, required this.radius, required this.padding, required this.gap, required this.maxWidth, required this.shadow, required this.borderColor, required this.borderWidth})

Parameters

Prop

Type

View source

background

field
final Color background
View source

background2

field
final Color background2
View source

backgroundKind

field
final String backgroundKind

solid | gradient | image.

View source

gradientAngle

field
final double gradientAngle

CSS degrees: 180 = top to bottom.

View source

backgroundImageUrl

field
final String? backgroundImageUrl
View source

radius

field
final double radius
View source

padding

field
final double padding
View source

gap

field
final double gap
View source

maxWidth

field
final double maxWidth
View source

shadow

field
final String shadow

none | sm | md | lg.

View source

borderColor

field
final Color borderColor
View source

borderWidth

field
final double borderWidth
View source

NexusInAppClose

class View source

NexusInAppClose

constructor
const NexusInAppClose({required this.show, required this.circle, required this.color, required this.atStart})

Parameters

Prop

Type

View source

show

field
final bool show
View source

circle

field
final bool circle
View source

color

field
final Color color
View source

atStart

field
final bool atStart
View source

NexusInAppTap

class

What tapping an image does.

View source

NexusInAppTap

constructor
const NexusInAppTap({required this.action, this.url, this.event})

Parameters

Prop

Type

View source

action

field
final String action

dismiss | url | event.

View source

url

field
final String? url
View source

event

field
final String? event
View source

NexusInAppBlock

sealed class
sealed class NexusInAppBlock

One block of a designed message.

View source

NexusInAppBlock

constructor
const NexusInAppBlock(this.id)

Parameters

Prop

Type

View source

tryParse()

static method
static NexusInAppBlock? tryParse(Map<String, dynamic> j)

Parameters

Prop

Type

Returns NexusInAppBlock?

View source

id

field
final String id
View source

NexusInAppImageBlock

class
class NexusInAppImageBlock extends NexusInAppBlock
View source

NexusInAppImageBlock

constructor
const NexusInAppImageBlock(super.id, {required this.url, this.aspectRatio, required this.contain, required this.radius, required this.bleed, this.tap})

Parameters

Prop

Type

View source

url

field
final String url
View source

aspectRatio

field
final double? aspectRatio

Null = the image's own ratio.

View source

contain

field
final bool contain
View source

radius

field
final double radius
View source

bleed

field
final bool bleed

Edge to edge — ignores the frame's padding.

View source

tap

field
final NexusInAppTap? tap
View source

NexusInAppBadgeBlock

class
class NexusInAppBadgeBlock extends NexusInAppBlock
View source

NexusInAppBadgeBlock

constructor
const NexusInAppBadgeBlock(super.id, {required this.text, required this.background, required this.foreground, required this.align})

Parameters

Prop

Type

View source

text

field
final String text
View source

background

field
final Color background
View source

foreground

field
final Color foreground
View source

align

field
final String align
View source

NexusInAppHeadingBlock

class
class NexusInAppHeadingBlock extends NexusInAppBlock
View source

NexusInAppHeadingBlock

constructor
const NexusInAppHeadingBlock(super.id, {required this.text, required this.size, required this.weight, required this.color, required this.align})

Parameters

Prop

Type

View source

text

field
final String text
View source

size

field
final double size
View source

weight

field
final int weight
View source

color

field
final Color color
View source

align

field
final String align
View source

NexusInAppTextBlock

class
class NexusInAppTextBlock extends NexusInAppBlock
View source

NexusInAppTextBlock

constructor
const NexusInAppTextBlock(super.id, {required this.text, required this.size, required this.color, required this.align, required this.lineHeight})

Parameters

Prop

Type

View source

text

field
final String text
View source

size

field
final double size
View source

color

field
final Color color
View source

align

field
final String align
View source

lineHeight

field
final double lineHeight
View source

NexusInAppButtonsBlock

class
class NexusInAppButtonsBlock extends NexusInAppBlock
View source

NexusInAppButtonsBlock

constructor
const NexusInAppButtonsBlock(super.id, {required this.row, required this.items})

Parameters

Prop

Type

View source

row

field
final bool row

Side by side (true) or stacked full-width (false).

View source

items

field
final List<NexusInAppDesignButton> items
View source

NexusInAppCarouselBlock

class
class NexusInAppCarouselBlock extends NexusInAppBlock

A swipeable row of up to 10 cards. Cards share the image shape and type sizes; all are as tall as the tallest, with buttons pinned to the bottom.

View source

NexusInAppCarouselBlock

constructor
const NexusInAppCarouselBlock(super.id, {required this.cards, required this.aspectRatio, required this.contain, required this.peek, required this.bleed, required this.radius, required this.gap, required this.padding, required this.titleSize, required this.bodySize, required this.showIndicator, required this.indicatorColor, required this.autoplaySeconds})

Parameters

Prop

Type

View source

cards

field
final List<NexusInAppCarouselCard> cards
View source

aspectRatio

field
final double aspectRatio
View source

contain

field
final bool contain
View source

peek

field
final bool peek

Show the edge of the next card (cards are 84% wide).

View source

bleed

field
final bool bleed

Edge to edge — ignores the frame's side padding.

View source

radius

field
final double radius
View source

gap

field
final double gap
View source

padding

field
final double padding
View source

titleSize

field
final double titleSize
View source

bodySize

field
final double bodySize
View source

showIndicator

field
final bool showIndicator
View source

indicatorColor

field
final Color indicatorColor
View source

autoplaySeconds

field
final int autoplaySeconds

0 = only by swiping.

View source

NexusInAppCarouselCard

class View source

NexusInAppCarouselCard

constructor
const NexusInAppCarouselCard({required this.id, this.imageUrl, required this.title, required this.body, this.button, this.tap, required this.background, required this.titleColor, required this.bodyColor, required this.align})

Parameters

Prop

Type

View source

id

field
final String id

Reported as the click's buttonId when the card itself is tapped.

View source

imageUrl

field
final String? imageUrl
View source

title

field
final String title
View source

body

field
final String body
View source

button

field
final NexusInAppDesignButton? button
View source

tap

field
final NexusInAppTap? tap
View source

background

field
final Color background
View source

titleColor

field
final Color titleColor
View source

bodyColor

field
final Color bodyColor
View source

align

field
final String align
View source

NexusInAppSpacerBlock

class
class NexusInAppSpacerBlock extends NexusInAppBlock
View source

NexusInAppSpacerBlock

constructor
const NexusInAppSpacerBlock(super.id, {required this.height})

Parameters

Prop

Type

View source

height

field
final double height
View source

NexusInAppDividerBlock

class
class NexusInAppDividerBlock extends NexusInAppBlock
View source

NexusInAppDividerBlock

constructor
const NexusInAppDividerBlock(super.id, {required this.color, required this.thickness})

Parameters

Prop

Type

View source

color

field
final Color color
View source

thickness

field
final double thickness
View source

NexusInAppDesignButton

class View source

NexusInAppDesignButton

constructor
const NexusInAppDesignButton({required this.id, required this.text, required this.action, this.url, this.event, this.value, required this.variant, required this.background, required this.foreground, required this.radius})

Parameters

Prop

Type

View source

id

field
final String id
View source

text

field
final String text
View source

action

field
final String action

dismiss | url | event | copy.

View source

url

field
final String? url
View source

event

field
final String? event
View source

value

field
final String? value

For copy: the text put on the clipboard.

View source

variant

field
final String variant

filled | outline | text.

View source

background

field
final Color background

Fill (filled) or border (outline) colour.

View source

foreground

field
final Color foreground

Label colour.

View source

radius

field
final double radius
View source

NexusInAppView

class
class NexusInAppView extends StatelessWidget

Default rendering for an in-app message. Bring your own UI via NexusInAppOverlay(messageBuilder: ...) if you'd rather.

View source

NexusInAppView

constructor
const NexusInAppView({super.key, required this.message, required this.onButton, required this.onDismiss})

Parameters

Prop

Type

View source

message

field
final NexusInAppMessage message
View source

onButton

field
final void Function(NexusInAppButton button) onButton
View source

onDismiss

field
final VoidCallback onDismiss
View source

NexusInAppDesignedView

class
class NexusInAppDesignedView extends StatefulWidget

Renders a message designed in the Nexus console: backdrop, placement for the layout, entrance animation, auto-dismiss, and the block stack.

Layout rules match the console preview exactly (padding, gap, edge-to-edge images, the close-button inset, shadows) — that is what makes the preview trustworthy. Fills the space it is given; NexusInAppOverlay gives it the whole screen.

View source

NexusInAppDesignedView

constructor
const NexusInAppDesignedView({super.key, required this.message, required this.design, required this.onButton, required this.onDismiss})

Parameters

Prop

Type

View source

message

field
final NexusInAppMessage message
View source

design

field
final NexusInAppDesign design
View source

onButton

field
final void Function(NexusInAppButton button) onButton
View source

onDismiss

field
final VoidCallback onDismiss
View source

NexusInAppBuilder

typedef
typedef NexusInAppBuilder = Widget Function(BuildContext context, NexusInAppMessage message, void Function(NexusInAppButton button) onButton, VoidCallback onDismiss)

Bring your own in-app message UI. Return a widget; drive it with the provided callbacks (button tap / dismiss).

View source

NexusInAppOverlay

class
class NexusInAppOverlay extends StatefulWidget

Hosts the currently-active in-app message above your app. Add it via MaterialApp.builder so it has a Material/Overlay/MediaQuery ancestor:

MaterialApp(
  builder: (context, child) => NexusInAppOverlay(child: child!),
  // ...
)
View source

NexusInAppOverlay

constructor
const NexusInAppOverlay({super.key, required this.child, this.messageBuilder})

Parameters

Prop

Type

View source

child

field
final Widget child
View source

messageBuilder

field
final NexusInAppBuilder? messageBuilder
View source

On this page

NexusInAppactivecurrentonActiononTrackEventsetProperties()clearProperties()attachRealtime()fetch()onEvent()show()tapButton()dismiss()close()dispose()NexusInAppActionNexusInAppActionmessageIdvariantIdbuttonIdactionurleventvalueNexusInAppButtonNexusInAppButtonNexusInAppButton.fromJsonidtextactionurleventvaluestyleNexusInAppMessageNexusInAppMessageNexusInAppMessage.fromJsonidlayouttitlebodyimageUrlbackgroundColortextColorbuttonstriggerTypetriggerEventmaxDisplaysperSessiondesignvariantIdisTestNexusInAppDesignNexusInAppDesigntryParse()blocksframeoverlayColordismissOnBackdropTapcloseanimationautoDismissSecondsdirectionresolveDirection()NexusInAppFrameNexusInAppFramebackgroundbackground2backgroundKindgradientAnglebackgroundImageUrlradiuspaddinggapmaxWidthshadowborderColorborderWidthNexusInAppCloseNexusInAppCloseshowcirclecoloratStartNexusInAppTapNexusInAppTapactionurleventNexusInAppBlockNexusInAppBlocktryParse()idNexusInAppImageBlockNexusInAppImageBlockurlaspectRatiocontainradiusbleedtapNexusInAppBadgeBlockNexusInAppBadgeBlocktextbackgroundforegroundalignNexusInAppHeadingBlockNexusInAppHeadingBlocktextsizeweightcoloralignNexusInAppTextBlockNexusInAppTextBlocktextsizecoloralignlineHeightNexusInAppButtonsBlockNexusInAppButtonsBlockrowitemsNexusInAppCarouselBlockNexusInAppCarouselBlockcardsaspectRatiocontainpeekbleedradiusgappaddingtitleSizebodySizeshowIndicatorindicatorColorautoplaySecondsNexusInAppCarouselCardNexusInAppCarouselCardidimageUrltitlebodybuttontapbackgroundtitleColorbodyColoralignNexusInAppSpacerBlockNexusInAppSpacerBlockheightNexusInAppDividerBlockNexusInAppDividerBlockcolorthicknessNexusInAppDesignButtonNexusInAppDesignButtonidtextactionurleventvaluevariantbackgroundforegroundradiusNexusInAppViewNexusInAppViewmessageonButtononDismissNexusInAppDesignedViewNexusInAppDesignedViewmessagedesignonButtononDismissNexusInAppBuilderNexusInAppOverlayNexusInAppOverlaychildmessageBuilder