null_assert_main.dart 508 Bytes
Newer Older
1 2 3 4
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
// @dart = 2.8
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

import 'null_enabled_api.dart';

void main() {
  dynamic error;
  try {
    // Validate that a generated null assertion is thrown.
    methodThatAcceptsNonNull(null);
  } catch (err) {
    error = err;
  }
  if (error is AssertionError) {
    print('--- TEST SUCCEEDED ---');
  } else {
    print('--- TEST FAILED ---');
  }
}