// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. // @dart=2.9 extension SafeAccess on Iterable { T get safeFirst { return isNotEmpty ? first : null; } } main() {} void test() { final list = []; list.safeFirst(); final list2 = []; list2.safeFirst(0); } void errors() { final list = []; list.safeFirst(); final list2 = []; list2.safeFirst(); }