tileImageAsync method

Future<Image?> tileImageAsync({
  1. double? size,
  2. Key? key,
  3. double scale = 1.0,
  4. Widget frameBuilder(
    1. BuildContext,
    2. Widget,
    3. int?,
    4. bool,
    )?,
  5. Widget errorBuilder(
    1. BuildContext,
    2. Object,
    3. StackTrace?
    )?,
  6. String? semanticLabel,
  7. bool excludeFromSemantics = false,
  8. Color? color,
  9. Animation<double>? opacity,
  10. BlendMode? colorBlendMode,
  11. BoxFit? fit,
  12. AlignmentGeometry alignment = Alignment.center,
  13. ImageRepeat repeat = ImageRepeat.noRepeat,
  14. Rect? centerSlice,
  15. bool matchTextDirection = false,
  16. bool gaplessPlayback = false,
  17. bool isAntiAlias = false,
  18. FilterQuality filterQuality = FilterQuality.low,
  19. int? cacheWidth,
  20. int? cacheHeight,
})

Retrieves the most recently modified tile from the store, extracts it's bytes, and renders them to an Image

Eventually returns null if there are no cached tiles in this store, otherwise an Image with size height and width.

This method requires the store to be ready, else an FMTCStoreNotReady error will be raised.

Implementation

Future<Image?> tileImageAsync({
  double? size,
  Key? key,
  double scale = 1.0,
  Widget Function(BuildContext, Widget, int?, bool)? frameBuilder,
  Widget Function(BuildContext, Object, StackTrace?)? errorBuilder,
  String? semanticLabel,
  bool excludeFromSemantics = false,
  Color? color,
  Animation<double>? opacity,
  BlendMode? colorBlendMode,
  BoxFit? fit,
  AlignmentGeometry alignment = Alignment.center,
  ImageRepeat repeat = ImageRepeat.noRepeat,
  Rect? centerSlice,
  bool matchTextDirection = false,
  bool gaplessPlayback = false,
  bool isAntiAlias = false,
  FilterQuality filterQuality = FilterQuality.low,
  int? cacheWidth,
  int? cacheHeight,
}) async {
  final latestTile = await _registry(_name)
      .tiles
      .where(sort: Sort.desc)
      .anyLastModified()
      .findFirst();
  if (latestTile == null) return null;

  return Image.memory(
    Uint8List.fromList(latestTile.bytes),
    key: key,
    scale: scale,
    frameBuilder: frameBuilder,
    errorBuilder: errorBuilder,
    semanticLabel: semanticLabel,
    excludeFromSemantics: excludeFromSemantics,
    width: size,
    height: size,
    color: color,
    opacity: opacity,
    colorBlendMode: colorBlendMode,
    fit: fit,
    alignment: alignment,
    repeat: repeat,
    centerSlice: centerSlice,
    matchTextDirection: matchTextDirection,
    gaplessPlayback: gaplessPlayback,
    isAntiAlias: isAntiAlias,
    filterQuality: filterQuality,
    cacheWidth: cacheWidth,
    cacheHeight: cacheHeight,
  );
}