Skip to content
Birju Vachhani edited this page Jul 30, 2020 · 3 revisions

Banner

Spider

A small dart library to generate Assets dart code from assets folder. It generates dart class with static const variables in it which can be used to reference the assets safely anywhere in the flutter app.

Breaking Changes since v1.0.0:

Instead of declaring package name separately for each group, spider now takes package key-value pair as a global configuration.

Example

Before

Widget build(BuildContext context) {
  return Image(image: AssetImage('assets/background.png'));
}

After

Widget build(BuildContext context) {
  return Image(image: AssetImage(Assets.background));
}

Generated Assets Class

class Assets {
  static const String background = 'assets/background.png';
}

This method allows no error scope for string typos. Also, it provides auto-complete in the IDE which comes very handy when you have large amount of assets.

Installation

This is package is an independent library that is not linked to your project. So there's no need to add it to your flutter project as it works as a global command line tool for all of your projects.

pub global activate spider

Run following command to see help:

spider --help

See Basic Usage page for more information on how to use.

Support Spider

Show some love and support by starring the repository.

Or You can

Buy Me A Coffee

License

Copyright © 2020 Birju Vachhani

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.