source_maps 0.10.4

  • Installing
  • Versions
  • 96

Source Maps

This project implements a Dart pub package to work with source maps. The implementation is based on the source map version 3 spec which was originated from the Closure Compiler and has been implemented in Chrome and Firefox.

In this package we provide:

  • Data types defining file locations and spans: these are not part of the original source map specification. These data types are great for tracking source locations on source maps, but they can also be used by tools to reporting useful error messages that include on source locations.
  • A builder that creates a source map programatically and produces the encoded source map format.
  • A parser that reads the source map format and provides APIs to read the mapping information.

Some upcoming features we are planning to add to this package are:

  • A printer that lets you generate code, but record source map information in the process.
  • A tool that can compose source maps together. This would be useful for instance, if you have 2 tools that produce source maps and you call one with the result of the other.


  • Implement highlight in SourceMapFileSpan.
  • Require version ^1.3.0 of source_span.


  • Add addMapping and containsMapping members to MappingBundle.


  • Support for extended source map format.
  • Polish MappingBundle.spanFor handling of URIs that have a suffix that exactly match a source map in the MappingBundle.


  • Fix strong mode warning in test.


  • Extend MappingBundle.spanFor to accept requests for output files that don't have source maps.


  • Add MappingBundle class that handles extended source map format that supports source maps for multiple output files in a single mapper. Extend Mapping.spanFor API to accept a uri parameter that is optional for normal source maps but required for MappingBundle source maps.


  • Fix more strong mode warnings.


  • Fix all strong mode warnings.


  • Add a mapUrl named argument to parse and parseJson. This argument is used to resolve source URLs for source spans.


  • Fix analyzer error (FileSpan has a new field since source_span 1.1.1)


  • Remove an unnecessary warning printed when the "file" field is missing from a Json formatted source map. This field is optional and its absence is not unusual.


  • Remove the Span, Location and SourceFile classes. Use the corresponding source_span classes instead.


  • Update SpanFormatException with source and offset.

  • All methods that take Spans, Locations, and SourceFiles as inputs now also accept the corresponding source_span classes as well. Using the old classes is now deprecated and will be unsupported in version 0.10.0.


  • Support writing SingleMapping objects to source map version 3 format.
  • Support the sourceRoot field in the SingleMapping class.
  • Support updating the targetUrl field in the SingleMapping class.


  • Fix a bug in FixedSpan.getLocationMessage.


  • Minor readability improvements to FixedSpan.getLocationMessage and SpanException.toString.


  • Add SpanException and SpanFormatException classes.


  • Support unmapped areas in source maps.

  • Increase the readability of location messages.

1. Depend on it

Add this to your package's pubspec.yaml file:

  source_maps: "^0.10.4"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:source_maps/source_maps.dart';
Version Uploaded Documentation Archive
0.10.4 Mar 23, 2017 Go to the documentation of source_maps 0.10.4 Download source_maps 0.10.4 archive
0.10.3 Mar 7, 2017 Go to the documentation of source_maps 0.10.3 Download source_maps 0.10.3 archive
0.10.2 Dec 14, 2016 Go to the documentation of source_maps 0.10.2 Download source_maps 0.10.2 archive
0.10.1+5 Dec 12, 2016 Go to the documentation of source_maps 0.10.1+5 Download source_maps 0.10.1+5 archive
0.10.1+4 Dec 9, 2016 Go to the documentation of source_maps 0.10.1+4 Download source_maps 0.10.1+4 archive
0.10.1+3 Dec 8, 2016 Go to the documentation of source_maps 0.10.1+3 Download source_maps 0.10.1+3 archive
0.10.1+2 Oct 31, 2016 Go to the documentation of source_maps 0.10.1+2 Download source_maps 0.10.1+2 archive
0.10.1+1 Mar 24, 2016 Go to the documentation of source_maps 0.10.1+1 Download source_maps 0.10.1+1 archive
0.10.1 Apr 29, 2015 Go to the documentation of source_maps 0.10.1 Download source_maps 0.10.1 archive
0.10.0+2 Mar 28, 2015 Go to the documentation of source_maps 0.10.0+2 Download source_maps 0.10.0+2 archive

All 93 versions...


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Jan 17, 2018
  • Dart: 2.0.0-dev.15.0
  • pana: 0.9.1


Describes how popular the package is relative to other packages. [more]
93 / 100
Code health derived from static analysis. [more]
100 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: Flutter, server, web

No platform restriction found in libraries.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use source_maps.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
source_span ^1.3.0 1.4.0
Transitive dependencies
charcode 1.1.1
path 1.5.1
Dev dependencies
test >=0.12.0 <0.13.0