{"id":18352497,"url":"https://github.com/stelynx/network_image_mock","last_synced_at":"2025-04-06T11:32:54.777Z","repository":{"id":36955382,"uuid":"259583456","full_name":"stelynx/network_image_mock","owner":"stelynx","description":"Mock response for Image.network to help Flutter widget tests pass.","archived":false,"fork":false,"pushed_at":"2023-04-03T11:47:08.000Z","size":29,"stargazers_count":28,"open_issues_count":7,"forks_count":14,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T22:33:20.981Z","etag":null,"topics":["dart","flutter","flutter-widget-tests","mocking","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stelynx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-28T08:56:08.000Z","updated_at":"2024-11-19T22:55:37.000Z","dependencies_parsed_at":"2024-06-19T01:45:32.636Z","dependency_job_id":null,"html_url":"https://github.com/stelynx/network_image_mock","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelynx%2Fnetwork_image_mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelynx%2Fnetwork_image_mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelynx%2Fnetwork_image_mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelynx%2Fnetwork_image_mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stelynx","download_url":"https://codeload.github.com/stelynx/network_image_mock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478152,"owners_count":20945258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter","flutter-widget-tests","mocking","testing-tools"],"created_at":"2024-11-05T21:36:10.368Z","updated_at":"2025-04-06T11:32:54.346Z","avatar_url":"https://github.com/stelynx.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Network Image Mock\n\n[![Pub Version](https://img.shields.io/pub/v/network_image_mock?color=%233dc6fd\u0026logo=flutter\u0026logoColor=%233dc6fd)](https://pub.dev/packages/network_image_mock)\n![Lint \u0026 Test](https://github.com/stelynx/network_image_mock/workflows/Lint%20\u0026%20Test/badge.svg)\n[![codecov.io](https://codecov.io/gh/stelynx/network_image_mock/branch/master/graphs/badge.svg)](https://codecov.io/gh/stelynx/network_image_mock/branch/master)\n![Null safety](https://img.shields.io/badge/null%20safety-^2.0.0-brightgreen)\n![No null safety](https://img.shields.io/badge/no%20null%20safety-1.1.0-orange)\n![GitHub Repo stars](https://img.shields.io/github/stars/stelynx/network_image_mock?color=gold\u0026logo=github\u0026style=plastic)\n![GitHub contributors](https://img.shields.io/github/contributors/stelynx/network_image_mock?logo=github)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/stelynx/network_image_mock)\n[![GitHub](https://img.shields.io/github/license/stelynx/network_image_mock)](LICENSE)\n\nA utility for providing mocked response to `Image.network` in Flutter widget tests.\n\n## Introduction\n\nSince you are here you probably already know that calling Image.network results in 400\nresponse in Flutter widget tests. The reason for this is that default HTTP client in tests\nalways return a 400.\n\nSo, what can we do about it? Instead of copying the whole code over and over again for mocking\nthe HTTP client, I created this package. It is heavily inspired by [roughike/image_test_utils](https://github.com/roughike/image_test_utils), however that package is not being maintained despite multiple pull requests\nasking for bumping the `mockito` version and making the package usable again.\n\n## Installing\n\n### Null safety\n\nThis package should be installed under `dev_dependencies` with\n\n```yaml\ndev_dependencies:\n  network_image_mock: ^2.0.1\n```\n\n### Without null safety (deprecated)\n\nIf you have legacy unmigrated code that does not use Null safety, install under `dev_dependencies` with\n\n```yaml\ndev_dependencies:\n  network_image_mock: 1.1.0\n```\n\n## Example\n\nThe package is quite straightforward to use. All you have to do is include it in your test\nfile and wrap widget testing functions that require proper `Image.network` response in\n`mockNetworkImagesFor()` function provided by this package. A full test example could look like this.\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:flutter_test/flutter_test.dart';\nimport 'package:network_image_mock/network_image_mock.dart';\n\nWidget makeTestableWidget() =\u003e MaterialApp(home: Image.network(''));\n\nvoid main() {\n  testWidgets(\n    'should properly mock Image.network and not crash',\n    (WidgetTester tester) async {\n      mockNetworkImagesFor(() =\u003e tester.pumpWidget(makeTestableWidget()));\n    },\n  );\n}\n```\n\nThis is actually an example taken from tests for this package.\n\n## Contributing\n\nThere is not much to contribute since the package serves its purpose, however, in chance of needing to bump or adjust some version, or any other suggestion for that matter, please read [CONTRIBUTING](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstelynx%2Fnetwork_image_mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstelynx%2Fnetwork_image_mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstelynx%2Fnetwork_image_mock/lists"}