Skip to content

Implementing a custom ImageProvider that generates a tile client side for the flutter/dart flutter_map package #1574

Closed Answered by erikandthecicada
erikandthecicada asked this question in Q&A
Discussion options

You must be logged in to vote

@ibrierley your counter questions helped me solve the problem! I had to directly use ImageDescriptor, as it allows for specifying the dimensions of your raw UInt8List image buffer, which was 256x256 and in rgba8888 format. Working code below:

import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/plugin_api.dart';
import 'dart:async';
import 'package:flutter/foundation.dart';

class CustomTileProvider extends TileProvider {
  @override
  ImageProvider getImage(TileCoordinates coordinates, TileLayer options) {
    return CustomImageProvider(coordinates, options);
  }
}

class

Replies: 8 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@erikandthecicada
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by erikandthecicada
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants