Skip to content

Instantly share code, notes, and snippets.

@Zujaj
Last active May 19, 2022 10:52
Show Gist options
  • Save Zujaj/e8ebf83631963548e16b09350c9ad305 to your computer and use it in GitHub Desktop.
Save Zujaj/e8ebf83631963548e16b09350c9ad305 to your computer and use it in GitHub Desktop.
The SVGData ChangeNotifier class.
import 'package:flutter/material.dart';
/// A [ChangeNotifier] that holds the svg text data.
class SVGData with ChangeNotifier {
/// Holds the `SVG` Formatted Code.
String code = '';
SVGData(this.code);
void updateCode(String previousColor, String newColor) {
code = code.replaceAll(previousColor, newColor);
notifyListeners();
}
@override
String toString() => 'SVGData(code:$code)';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment