Calculate sha256 hash in dart
Use the crypto
package we can calculate sha hash:
Install:
$ dart pub add crypto
Example:
import 'dart:convert';
import 'package:crypto/crypto.dart';
String sha256hash(String s) {
var bytes = utf8.encode(s); // data being hashed
return sha256.convert(bytes).toString();
}