import 'dart:typed_data';

import 'package:app_business/service/api.dart';
import 'package:track_common/model.dart';

import '../generated/base.pb.dart' as pb;

extension PBGameMap on pb.NetImage {
  GameMap toGameMap() {
    final md5Data = Uint8List.fromList(md5);

    return GameMap()
      ..url = url
      ..md5 = md5Data
      ..readerBuilder = () => Get.find<ApiService>().getBinReaderByMd5(md5Data);
  }
}
