It depends on the kind of ransomware.
avast can detect e.g. Cryptolocker.

What avast can detect:
https://www.avast.com/virus-update-history