Check out example codes for "dart test expect assert fail". It will help you in understanding the concepts better.

Code Example 1

import 'package:test/test.dart';

void main() {
  test('assert throws assert', () {
    expect(() {
      assert(false);
    }, throwsA(isA<AssertionError>());
  });
}

Learn ReactJs, React Native from akashmittal.com