import 'dart:ui';
import 'package:flutter/material.dart';

class ImaginiImageProvider extends ImageProvider<ImaginiImageProvider> {
  @override
  final String url;

  @override
  final double scale;

  @override
  final Map<String, String> headers;

  ImaginiImageProvider(this.url, {this.scale = 1.0, this.headers})
      : assert(url != null),
        assert(scale != null);

  NetworkImage _netImg;

  @override
  ImageStreamCompleter load(ImaginiImageProvider key, DecoderCallback decode) {
    return MultiFrameImageStreamCompleter(
      codec: _loadAsync(decode),
      scale: 1.0,
      debugLabel: fileId,
      informationCollector: () sync* {
        yield ErrorDescription('Path: $fileId');
      },
    );
  }

  Future<Codec> _loadAsync(DecoderCallback decode) async {
    _netImg._loadAsync(decode);
  }

  @override
  Future<ImaginiImageProvider> obtainKey(ImageConfiguration configuration) {

  }
}
